From 1e1e5a86c48c440dc8f406b6b4c449a470605c5b Mon Sep 17 00:00:00 2001 From: parsons Date: Mon, 5 Feb 2007 23:48:07 +0000 Subject: ChangeLogTag: Mon Feb 5 23:30:42 UTC 2007 Jeff Parsons --- TAO/TAO_IDL/ast/ast_decl.cpp | 12 ++++++++- TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp | 30 ++++++++++++---------- TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp | 10 +++++++- TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp | 3 ++- 4 files changed, 39 insertions(+), 16 deletions(-) (limited to 'TAO/TAO_IDL') diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp index b1ed63db3e6..e42735dff0c 100644 --- a/TAO/TAO_IDL/ast/ast_decl.cpp +++ b/TAO/TAO_IDL/ast/ast_decl.cpp @@ -861,7 +861,7 @@ AST_Decl::full_name (void) { if (this->full_name_ == 0) { - compute_full_name (); + this->compute_full_name (); } return this->full_name_; @@ -1274,6 +1274,16 @@ AST_Decl::set_name (UTL_ScopedName *n) } this->original_local_name (n->last_component ()); + + // These will be recomputed on demand. + delete [] this->flat_name_; + this->flat_name_ = 0; + + delete [] this->full_name_; + this->full_name_ = 0; + + delete [] this->repoID_; + this->repoID_ = 0; } } 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..dbc90dd7d4d 100644 --- a/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_field/field_ch.cpp @@ -325,26 +325,30 @@ be_visitor_field_ch::visit_sequence (be_sequence *node) be_field::narrow_from_decl (this->ctx_->node ()); node->field_node (member_node); - be_visitor_context ctx (*this->ctx_); - ctx.node (node); - - // First generate the sequence declaration. - be_visitor_sequence_ch visitor (&ctx); - - if (node->accept (&visitor) == -1) + // This was already generated in the corresponding valuetype class. + if (this->ctx_->state () != TAO_CodeGen::TAO_VALUETYPE_OBV_CH) { - ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_field_ch::" - "visit_sequence - " - "codegen failed\n"), - -1); + be_visitor_context ctx (*this->ctx_); + ctx.node (node); + + // First generate the sequence declaration. + be_visitor_sequence_ch visitor (&ctx); + + if (node->accept (&visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_field_ch::" + "visit_sequence - " + "codegen failed\n"), + -1); + } } // 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) { // Generate the anonymous sequence member typedef. diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp index 7752e68912a..bb24a94bec1 100644 --- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp @@ -50,7 +50,14 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node) -1); } - if (node->cli_hdr_gen () || node->imported ()) + // We don't check cli_hdr_gen() here. If we are generated more + // than once as an anonymous sequence, the name guard will cause + // the C++ preprocessor to catch it. If we are generated more than + // once as a typedef (caused by a comma separated list of + // typedefs), our name will be changed by the call above and the + // name guard will not catch it, but that's ok - we want to + // be generated for each typedef. + if (node->imported ()) { return 0; } @@ -99,6 +106,7 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; + os->gen_ifdef_macro (node->flat_name ()); if (this->ctx_->tdef () != 0) diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp index 5a245ed5c27..e61f3800d68 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_ch.cpp @@ -544,7 +544,8 @@ be_visitor_valuetype_field_ch::visit_sequence (be_sequence *node) // Not a typedef and bt is defined here. if (bt->node_type () != AST_Decl::NT_typedef - && bt->is_child (bu)) + && bt->is_child (bu) + && this->ctx_->state () != TAO_CodeGen::TAO_VALUETYPE_OBV_CH) { be_field *member_node = be_field::narrow_from_decl (this->ctx_->node ()); -- cgit v1.2.1