diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp | 72 |
1 files changed, 57 insertions, 15 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp index ea9cec530ae..e0bc53cf9ac 100644 --- a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp @@ -282,20 +282,64 @@ be_visitor_field_ch::visit_predefined_type (be_predefined_type *node) bt = node; } - *os << bt->nested_type_name (this->ctx_->scope ()); + // If we are a typedef of a basic type, ACE_NESTED_CLASS might + // be emitted as part of the type name, in which case the '::' + // would be incorrect for certain expansions of the macro. + if (td == 0) + { + *os << "::"; + } + + AST_PredefinedType::PredefinedType pt = node->pt (); + + if (pt == AST_PredefinedType::PT_object + || pt == AST_PredefinedType::PT_abstract) + { + *os << bt->name () << "_var"; + } + else if (pt == AST_PredefinedType::PT_value) + { + *os << bt->name () << " *"; + } + else if (pt == AST_PredefinedType::PT_pseudo) + { + // This was a typedefed array. + // ACE_NESTED_CLASS macro generated by nested_type_name + // is necessary if the struct, union, or valuetype containing this + // field was not defined inside a module. In such a case, VC++ + // complains that the non-module scope is not yet fully defined. + UTL_Scope *holds_container = this->ctx_->scope ()->defined_in (); + AST_Decl *hc_decl = ScopeAsDecl (holds_container); - switch (node->pt ()) + if (hc_decl->node_type () != AST_Decl::NT_module) + { + *os << bt->nested_type_name (this->ctx_->scope (), "_var"); + } + else + { + *os << bt->name () << "_var"; + } + } + else { - case AST_PredefinedType::PT_object: - case AST_PredefinedType::PT_abstract: - case AST_PredefinedType::PT_pseudo: - *os << "_var"; - break; - case AST_PredefinedType::PT_value: - *os << " *"; - break; - default: - break; + // This was a typedefed array. + // ACE_NESTED_CLASS macro generated by nested_type_name + // is necessary if the struct, union, or valuetype containing this + // field was not defined inside a module. In such a case, VC++ + // complains that the non-module scope is not yet fully defined. + UTL_Scope *holds_container = this->ctx_->scope ()->defined_in (); + AST_Decl *hc_decl = ScopeAsDecl (holds_container); + + if (hc_decl->node_type () != AST_Decl::NT_module) + { + *os << bt->nested_type_name (this->ctx_->scope ()); + } + else + { + // All the predefined types are in the CORBA namespace, + // so we go ahead and add the global :: qualifier. + *os << bt->name (); + } } return 0; @@ -343,9 +387,7 @@ be_visitor_field_ch::visit_sequence (be_sequence *node) // If we are being reused by valutype, this would get generated // in the private section of the OBV_xx class, so we must // generate the typedef for that case elsewhere. - AST_Decl::NodeType snt = this->ctx_->scope ()->node_type (); - - if (snt != AST_Decl::NT_valuetype && snt != AST_Decl::NT_eventtype) + if (this->ctx_->scope ()->node_type () != AST_Decl::NT_valuetype) { // Generate the anonymous sequence member typedef. be_decl *bs = this->ctx_->scope (); |