本文整理汇总了C++中AST_Decl::prefix方法的典型用法代码示例。如果您正苦于以下问题:C++ AST_Decl::prefix方法的具体用法?C++ AST_Decl::prefix怎么用?C++ AST_Decl::prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AST_Decl
的用法示例。
在下文中一共展示了AST_Decl::prefix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
// This serves for structs and unions.
void
AST_Structure::fwd_redefinition_helper (AST_Structure *&i,
UTL_Scope *s)
{
if (i == 0)
{
return;
}
// Fwd redefinition should be in the same scope, so local
// lookup is all that's needed.
AST_Decl *d =
s->lookup_by_name_local (i->local_name (), false);
AST_Structure *fd = 0;
if (d != 0)
{
// Full definition must have the same prefix as the forward declaration.
if (ACE_OS::strcmp (i->prefix (), d->prefix ()) != 0)
{
idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT,
i);
return;
}
AST_Decl::NodeType nt = d->node_type ();
// If this interface has been forward declared in a previous opening
// of the module it's defined in, the lookup will find the
// forward declaration.
if (nt == AST_Decl::NT_struct_fwd
|| nt == AST_Decl::NT_union_fwd)
{
AST_StructureFwd *fwd_def =
AST_StructureFwd::narrow_from_decl (d);
fd = fwd_def->full_definition ();
}
// In all other cases, the lookup will find an interface node.
else if (nt == AST_Decl::NT_struct
|| nt == AST_Decl::NT_union)
{
fd = AST_Structure::narrow_from_decl (d);
}
// Successful?
if (fd == 0)
{
// Should we give an error here?
// No, look in fe_add_interface.
}
// If it is a forward declared interface..
else if (!fd->is_defined ())
{
// Check if redefining in same scope. If a module is reopened,
// a new pointer in created, and the first term below will be
// true. In that case, the scoped names must be compared.
if (fd->defined_in () != s
&& i->name ()->compare (fd->name ()) != 0)
{
idl_global->err ()->error2 (UTL_Error::EIDL_SCOPE_CONFLICT,
i,
fd);
}
// All OK, do the redefinition.
else
{
AST_Decl::NodeType fd_nt = fd->node_type ();
AST_Decl::NodeType i_nt = i->node_type ();
// Only redefinition of the same kind.
if (i_nt != fd_nt)
{
idl_global->err ()->error2 (UTL_Error::EIDL_REDEF,
i,
fd);
return;
}
fd->redefine (i);
AST_StructureFwd *fwd = fd->fwd_decl ();
if (0 != fwd)
{
// So the fwd decl won't destroy us at cleanup time.
// Unlike interfaces, valuetypes and components, it's
// ok to do this here, since fwd declared structs
// and unions must be defined in the same translation
// unit.
fwd->set_as_defined ();
}
// Use full definition node.
i->destroy ();
delete i;
i = fd;
}
//.........这里部分代码省略.........