diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-04-07 14:58:42 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-04-07 14:58:42 +0000 |
commit | 9bb2c02521eccb898af6a0d7404b0df896a877d9 (patch) | |
tree | 210ac731c9a420b70fa2aad4b0e0f7bf2802703c /TAO/TAO_IDL/be/be_visitor_constant | |
parent | 313c681b71f3744014ebfd1fe435e4ce2fa17323 (diff) | |
download | ATCD-9bb2c02521eccb898af6a0d7404b0df896a877d9.tar.gz |
ChangeLogTag: Thu Apr 7 09:25:24 2005 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_constant')
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp | 20 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp | 14 |
2 files changed, 25 insertions, 9 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp index a6809150167..2590afdcf9b 100644 --- a/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_ch.cpp @@ -57,6 +57,8 @@ be_visitor_constant_ch::visit_constant (be_constant *node) AST_Decl::NodeType nt = AST_Decl::NT_pre_defined; AST_Decl *tdef = node->constant_value ()->get_tdef (); AST_Decl::NodeType bnt = AST_Decl::NT_pre_defined; + AST_Expression::ExprType etype = node->et (); + AST_Decl::NodeType snt = node->defined_in ()->scope_node_type (); if (tdef != 0) { @@ -71,7 +73,7 @@ be_visitor_constant_ch::visit_constant (be_constant *node) { *os << "const "; - if (node->et () == AST_Expression::EV_enum) + if (etype == AST_Expression::EV_enum) { *os << node->enum_full_name (); } @@ -89,8 +91,6 @@ be_visitor_constant_ch::visit_constant (be_constant *node) // We are nested inside an interface or a valuetype. else { - AST_Decl::NodeType snt = node->defined_in ()->scope_node_type (); - if (snt != AST_Decl::NT_module) { *os << "static "; @@ -102,7 +102,7 @@ be_visitor_constant_ch::visit_constant (be_constant *node) *os << "const "; - if (node->et () == AST_Expression::EV_enum) + if (etype == AST_Expression::EV_enum) { *os << node->enum_full_name (); } @@ -125,16 +125,22 @@ be_visitor_constant_ch::visit_constant (be_constant *node) *os << " " << node->local_name (); } + // If this is true, can't generate inline constants. + bool string_in_class = (snt != AST_Decl::NT_root + && snt != AST_Decl::NT_module + && (etype == AST_Expression::EV_string + || etype == AST_Expression::EV_wstring)); + // (JP) Workaround for VC6's broken handling of inline constants // until the day comes when we no longer support it. This won't // work for cross-compiling - hopefully the whole issue will soon // be moot. #if defined (_MSC_VER) && (_MSC_VER < 1300) if (!node->is_nested () - || (node->defined_in ()->scope_node_type () == AST_Decl::NT_module - && be_global->gen_inline_constants ())) + || (snt == AST_Decl::NT_module && be_global->gen_inline_constants ())) #else - if (!node->is_nested () || be_global->gen_inline_constants ()) + if (!node->is_nested () + || (be_global->gen_inline_constants () && !string_in_class)) #endif { *os << " = " << node->constant_value (); diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp index 885c3841969..9eeaa1ce6c8 100644 --- a/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_constant/constant_cs.cpp @@ -48,6 +48,15 @@ be_visitor_constant_cs::visit_constant (be_constant *node) return 0; } + AST_Expression::ExprType etype = node->et (); + AST_Decl::NodeType snt = node->defined_in ()->scope_node_type (); + + // If this is true, can't generate inline constants. + bool string_in_class = (snt != AST_Decl::NT_root + && snt != AST_Decl::NT_module + && (etype == AST_Expression::EV_string + || etype == AST_Expression::EV_wstring)); + // (JP) Workaround for VC6's broken handling of inline constants // until the day comes when we no longer support it. This won't // work for cross-compiling - hopefully the whole issue will soon @@ -55,10 +64,11 @@ be_visitor_constant_cs::visit_constant (be_constant *node) // Was the constant value already assigned in *C.h? #if defined (_MSC_VER) && (_MSC_VER < 1300) - if (node->defined_in ()->scope_node_type () == AST_Decl::NT_module + if (snt == AST_Decl::NT_module && be_global->gen_inline_constants ()) #else - if (be_global->gen_inline_constants () || !node->is_nested ()) + if (!node->is_nested () + || (be_global->gen_inline_constants () && !string_in_class)) #endif { return 0; |