summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
index 750f5f9bcfd..2ba08492dcd 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/cdr_op_cs.cpp
@@ -49,6 +49,7 @@ be_visitor_array_cdr_op_cs::visit_array (be_array *node)
// Retrieve the base type.
be_type *bt = be_type::narrow_from_decl (node->base_type ());
+ AST_Decl::NodeType nt = bt->node_type ();
if (!bt)
{
@@ -62,7 +63,7 @@ be_visitor_array_cdr_op_cs::visit_array (be_array *node)
// If we contain an anonymous sequence,
// generate code for the sequence here.
- if (bt->node_type () == AST_Decl::NT_sequence)
+ if (nt == AST_Decl::NT_sequence)
{
if (this->gen_anonymous_base_type (bt,
TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS)
@@ -76,5 +77,44 @@ be_visitor_array_cdr_op_cs::visit_array (be_array *node)
}
}
+ // If the array is an anonymous member and if its element type
+ // is a declaration (not a reference), we must generate code for
+ // the declaration.
+ if (this->ctx_->alias () == 0 // Not a typedef.
+ && bt->is_child (this->ctx_->scope ()))
+ {
+ int status = 0;
+ be_visitor_context ctx (*this->ctx_);
+
+ switch (nt)
+ {
+ case AST_Decl::NT_struct:
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
+ be_visitor_structure_cdr_op_cs sc_visitor (&ctx);
+ status = bt->accept (&sc_visitor);
+ break;
+ }
+ case AST_Decl::NT_union:
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
+ be_visitor_union_cdr_op_cs uc_visitor (&ctx);
+ status = bt->accept (&uc_visitor);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_array_ch::"
+ "visit_array - "
+ "array base type codegen failed\n"),
+ -1);
+ }
+ }
+
return 0;
}