Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / TAO_IDL / be / be_visitor_union / discriminant_cs.cpp
blobd147b318362e2384922db18f965b3bef42e981d7
2 //=============================================================================
3 /**
4 * @file discriminant_cs.cpp
6 * Visitor generating code for discriminant of the union
8 * @author Aniruddha Gokhale
9 */
10 //=============================================================================
12 #include "union.h"
14 be_visitor_union_discriminant_cs::be_visitor_union_discriminant_cs (
15 be_visitor_context *ctx
17 : be_visitor_decl (ctx)
21 be_visitor_union_discriminant_cs::~be_visitor_union_discriminant_cs ()
25 int
26 be_visitor_union_discriminant_cs::visit_enum (be_enum *node)
28 be_union *bu =
29 dynamic_cast<be_union*> (this->ctx_->node ());
30 be_type *bt = nullptr;
32 if (this->ctx_->alias ())
34 bt = this->ctx_->alias ();
36 else
38 bt = node;
41 if (bt->node_type () != AST_Decl::NT_typedef
42 && bt->is_child (bu))
44 // Instantiate a visitor context with a copy of our context. This info
45 // will be modified based on what type of node we are visiting.
46 be_visitor_context ctx (*this->ctx_);
47 ctx.node (node);
49 // generate the typecode for the enum
50 be_visitor_enum_cs visitor (&ctx);
52 if (node->accept (&visitor) == -1)
54 ACE_ERROR_RETURN ((LM_ERROR,
55 "(%N:%l) be_visitor_union_discriminant_cs::"
56 "visit_enum - "
57 "codegen failed\n"),
58 -1);
62 return 0;