本文整理汇总了C++中AST_Type::unaliased_type方法的典型用法代码示例。如果您正苦于以下问题:C++ AST_Type::unaliased_type方法的具体用法?C++ AST_Type::unaliased_type怎么用?C++ AST_Type::unaliased_type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AST_Type
的用法示例。
在下文中一共展示了AST_Type::unaliased_type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool
AST_illegal_recursive_type (AST_Decl *t)
{
if (t == 0)
{
return false;
}
AST_Decl::NodeType nt;
AST_Type *ut = AST_Type::narrow_from_decl (t);
if (ut != 0)
{
ut = ut->unaliased_type ();
nt = ut->node_type ();
}
else
{
nt = t->node_type ();
}
if (nt == AST_Decl::NT_interface)
{
// Check for interface->struct/union->....->interface nesting.
// return AST_illegal_interface_recursion (t);
}
else if (nt != AST_Decl::NT_struct && nt != AST_Decl::NT_union)
{
// Structs and unions fall through to the check below.
return false; // NOT ILLEGAL.
}
bool check_for_struct = false;
bool check_for_union = false;
AST_Structure *st1 = 0;
AST_Union *un1 = 0;
// Narrow the type appropriately so comparison will work.
if (t->node_type () == AST_Decl::NT_struct)
{
check_for_struct = true;
st1 = AST_Structure::narrow_from_decl (t);
if (st1 == 0)
{
return false; // NOT ILLEGAL.
}
}
else if (t->node_type () == AST_Decl::NT_union)
{
check_for_union = true;
un1 = AST_Union::narrow_from_decl (t);
if (un1 == 0)
{
return false; // NOT ILLEGAL.
}
}
UTL_Scope *s = 0;
AST_Structure *st2 = 0;
AST_Union *un2 = 0;
// OK, iterate up the stack.
for (UTL_ScopeStackActiveIterator i (idl_global->scopes ());
!i.is_done ();
i.next ())
{
s = i.item ();
// If we hit a NULL we're done since it means that we're nested inside
// a sequence, where recursive types may be used.
if (s == 0)
{
return false; // NOT ILLEGAL.
}
// OK, must check this scope.
if (s->scope_node_type () == AST_Decl::NT_struct
&& check_for_struct == true)
{
st2 = AST_Structure::narrow_from_scope (s);
if (st2 != 0 && st2 == st1)
{
return true; // ILLEGAL RECURSIVE TYPE USE.
}
}
else if (s->scope_node_type () == AST_Decl::NT_union
&& check_for_union == true)
{
un2 = AST_Union::narrow_from_scope (s);
if (un2 != 0 && un2 == un1)
{
return true; // ILLEGAL RECURSIVE TYPE USE.
}
}
}
//.........这里部分代码省略.........