summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2010-01-16 18:50:07 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2010-01-16 18:50:07 +0000
commite4a5d0294113b23d37fb3cfa69df6ecdf0c2bc53 (patch)
tree16eee7842b481756abfc3f617bf0651f09060d29 /TAO
parentd71ba95566174c692334bd2462313d02e69ca1df (diff)
downloadATCD-e4a5d0294113b23d37fb3cfa69df6ecdf0c2bc53.tar.gz
Sat Jan 16 18:48:19 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
Merged revision 88565-88579 from idl3_plus_backend2 to svn head Fri Jan 15 20:31:51 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/include/idl_global.h: * TAO_IDL/be/be_visitor_tmpl_module_inst.cpp: * TAO_IDL/be/be_visitor_context.cpp: * TAO_IDL/be/be_visitor_reifying.cpp: * TAO_IDL/be_include/be_visitor_context.h: * TAO_IDL/be_include/be_visitor_reifying.h: * TAO_IDL/util/utl_global.cpp: * TAO_IDL/util/utl_scope.cpp: - Removed the template module instantation scope storage in the visitor context, using instead the global scope stack for that purpose. - Modified reifying visitor to find and store a node already created in a template module instantiation, if the corresponding node is referenced in the template module. Fri Jan 15 15:31:56 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu> * TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp: Reverted a small change made yesterday where the generation of a double colon was prefixed to a name that is not global.
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog33
-rw-r--r--TAO/TAO_IDL/be/be_visitor_context.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_reifying.cpp104
-rw-r--r--TAO/TAO_IDL/be/be_visitor_tmpl_module_inst.cpp202
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_context.h7
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_reifying.h5
-rw-r--r--TAO/TAO_IDL/include/idl_global.h2
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp20
9 files changed, 201 insertions, 198 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 6f271f8bb4d..e259d3d4e2e 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,36 @@
+Sat Jan 16 18:48:19 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
+
+ Merged revision 88565-88579 from idl3_plus_backend2 to svn head
+
+ Fri Jan 15 20:31:51 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/include/idl_global.h:
+ * TAO_IDL/be/be_visitor_tmpl_module_inst.cpp:
+ * TAO_IDL/be/be_visitor_context.cpp:
+ * TAO_IDL/be/be_visitor_reifying.cpp:
+ * TAO_IDL/be_include/be_visitor_context.h:
+ * TAO_IDL/be_include/be_visitor_reifying.h:
+ * TAO_IDL/util/utl_global.cpp:
+ * TAO_IDL/util/utl_scope.cpp:
+
+ - Removed the template module instantation
+ scope storage in the visitor context, using
+ instead the global scope stack for that
+ purpose.
+
+ - Modified reifying visitor to find and store
+ a node already created in a template module
+ instantiation, if the corresponding node is
+ referenced in the template module.
+
+ Fri Jan 15 15:31:56 UTC 2010 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp:
+
+ Reverted a small change made yesterday where the
+ generation of a double colon was prefixed to a name
+ that is not global.
+
Fri Jan 15 13:25:19 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl>
* TAO_IDL/Makefile.am:
diff --git a/TAO/TAO_IDL/be/be_visitor_context.cpp b/TAO/TAO_IDL/be/be_visitor_context.cpp
index 3d4d682ec6e..476c62780d4 100644
--- a/TAO/TAO_IDL/be/be_visitor_context.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_context.cpp
@@ -55,8 +55,7 @@ be_visitor_context::be_visitor_context (void)
comma_ (0),
interface_ (0),
template_params_ (0),
- template_args_ (0),
- template_module_inst_scope_ (0)
+ template_args_ (0)
{
}
@@ -71,7 +70,9 @@ be_visitor_context::be_visitor_context (const be_visitor_context &ctx)
attr_ (ctx.attr_),
exception_ (ctx.exception_),
comma_ (ctx.comma_),
- interface_ (ctx.interface_)
+ interface_ (ctx.interface_),
+ template_params_ (ctx.template_params_),
+ template_args_ (ctx.template_args_)
{
}
@@ -89,6 +90,8 @@ be_visitor_context::operator= (const be_visitor_context &ctx)
this->exception_ = ctx.exception_;
this->comma_ = ctx.comma_;
this->interface_ = ctx.interface_;
+ this->template_args_ = ctx.template_args_;
+ this->template_params_ = ctx.template_params_;
return *this;
}
@@ -114,6 +117,8 @@ be_visitor_context::reset (void)
this->exception_ = 0;
this->comma_ = 0;
this->interface_ = 0;
+ this->template_args_ = 0;
+ this->template_params_ = 0;
}
void
@@ -272,19 +277,6 @@ be_visitor_context::template_args (FE_Utils::T_ARGLIST *args)
this->template_args_ = args;
}
-be_scope *
-be_visitor_context::template_module_inst_scope (void) const
-{
- return this->template_module_inst_scope_;
-}
-
-void
-be_visitor_context::template_module_inst_scope (UTL_Scope *s)
-{
- this->template_module_inst_scope_ =
- be_scope::narrow_from_scope (s);
-}
-
// ****************************************************************
be_argument *
diff --git a/TAO/TAO_IDL/be/be_visitor_reifying.cpp b/TAO/TAO_IDL/be/be_visitor_reifying.cpp
index 7d5c4ddda0f..e0ef03118da 100644
--- a/TAO/TAO_IDL/be/be_visitor_reifying.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_reifying.cpp
@@ -49,7 +49,23 @@ be_visitor_reifying::reified_node (void) const
int
be_visitor_reifying::visit_interface (be_interface *node)
{
- this->reified_node_ = node;
+ UTL_ScopedName *tmpl_tail =
+ this->template_module_rel_name (node);
+
+ if (tmpl_tail != 0)
+ {
+ AST_Decl *d =
+ idl_global->scopes ().top ()->lookup_by_name (
+ tmpl_tail,
+ true);
+
+ this->reified_node_ = d;
+ }
+ else
+ {
+ this->reified_node_ = node;
+ }
+
return 0;
}
@@ -93,7 +109,7 @@ be_visitor_reifying::visit_array (be_array *node)
{
be_type *bt =
be_type::narrow_from_decl (node->base_type ());
-
+
if (bt->accept (this) != 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -102,18 +118,18 @@ be_visitor_reifying::visit_array (be_array *node)
ACE_TEXT ("visit of base type failed\n")),
-1);
}
-
+
bt = be_type::narrow_from_decl (this->reified_node_);
-
+
AST_Expression **dims = node->dims ();
AST_Expression *v = 0;
UTL_ExprList *v_list = 0;
-
+
for (ACE_CDR::ULong i = 0; i < node->n_dims (); ++i)
{
be_param_holder *ph =
be_param_holder::narrow_from_decl (dims[i]->param_holder ());
-
+
if (ph != 0)
{
if (this->visit_param_holder (ph) != 0)
@@ -125,10 +141,10 @@ be_visitor_reifying::visit_array (be_array *node)
ACE_TEXT ("failed\n")),
-1);
}
-
+
AST_Constant *c =
AST_Constant::narrow_from_decl (this->reified_node_);
-
+
ACE_NEW_RETURN (v,
AST_Expression (c->constant_value (),
AST_Expression::EV_ulong),
@@ -141,12 +157,12 @@ be_visitor_reifying::visit_array (be_array *node)
AST_Expression::EV_ulong),
-1);
}
-
+
UTL_ExprList *el = 0;
ACE_NEW_RETURN (el,
UTL_ExprList (v, 0),
-1);
-
+
if (v_list == 0)
{
v_list = el;
@@ -156,12 +172,12 @@ be_visitor_reifying::visit_array (be_array *node)
v_list->nconc (el);
}
}
-
+
UTL_ScopedName sn (node->name ()->last_component ()->copy (),
0);
-
+
be_array *arr = 0;
-
+
ACE_NEW_RETURN (arr,
be_array (&sn,
node->n_dims (),
@@ -169,15 +185,19 @@ be_visitor_reifying::visit_array (be_array *node)
false,
false),
-1);
-
+
+
+ // No need to add this new node to any scope - it's anonymous
+ // and owned by the node that references it.
+
sn.destroy ();
v_list->destroy ();
delete v_list;
v_list = 0;
-
+
arr->set_base_type (bt);
this->reified_node_ = arr;
-
+
return 0;
}
@@ -186,7 +206,7 @@ be_visitor_reifying::visit_sequence (be_sequence *node)
{
be_type *bt =
be_type::narrow_from_decl (node->base_type ());
-
+
if (bt->accept (this) != 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -195,13 +215,13 @@ be_visitor_reifying::visit_sequence (be_sequence *node)
ACE_TEXT ("visit of base type failed\n")),
-1);
}
-
+
bt = be_type::narrow_from_decl (this->reified_node_);
-
+
AST_Expression *v = node->max_size ();
be_param_holder *ph =
be_param_holder::narrow_from_decl (v->param_holder ());
-
+
if (ph != 0)
{
if (this->visit_param_holder (ph) != 0)
@@ -213,19 +233,19 @@ be_visitor_reifying::visit_sequence (be_sequence *node)
ACE_TEXT ("failed\n")),
-1);
}
-
+
AST_Constant *c =
AST_Constant::narrow_from_decl (this->reified_node_);
-
+
v = c->constant_value ();
}
-
+
AST_Expression *bound = 0;
ACE_NEW_RETURN (bound,
AST_Expression (v,
AST_Expression::EV_ulong),
-1);
-
+
Identifier id ("sequence");
UTL_ScopedName sn (&id, 0);
@@ -236,6 +256,10 @@ be_visitor_reifying::visit_sequence (be_sequence *node)
false,
false),
-1);
+
+ // No need to add this new node to any scope - it's anonymous
+ // and owned by the node that references it.
+
return 0;
}
@@ -276,16 +300,16 @@ be_visitor_reifying::visit_param_holder (be_param_holder *node)
{
FE_Utils::T_Param_Info *item = 0;
iter.next (item);
-
+
if (item == node->info ())
{
AST_Decl **ret_ptr = 0;
-
+
if (t_args->get (ret_ptr, i) == 0)
{
be_decl *candidate =
be_decl::narrow_from_decl (*ret_ptr);
-
+
return candidate->accept (this);
}
else
@@ -302,7 +326,7 @@ be_visitor_reifying::visit_param_holder (be_param_holder *node)
}
}
}
-
+
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_reifying::")
ACE_TEXT ("visit_param_holder() - no match for ")
@@ -312,21 +336,27 @@ be_visitor_reifying::visit_param_holder (be_param_holder *node)
-1);
}
-bool
-be_visitor_reifying::declared_in_template_module (AST_Decl *d)
+UTL_ScopedName *
+be_visitor_reifying::template_module_rel_name (AST_Decl *d)
{
AST_Decl *tmp = d;
-
+ ACE_CString name (d->full_name ());
+
while (tmp != 0)
{
if (AST_Template_Module::narrow_from_decl (tmp) != 0)
{
- return true;
+ ACE_CString head (tmp->local_name ()->get_string ());
+
+ ACE_CString::size_type start = name.find (head) + 2;
+
+ ACE_CString tail (name.substr (start + head.length ()));
+
+ return idl_global->string_to_scoped_name (tail.c_str ());
}
-
+
tmp = ScopeAsDecl (tmp->defined_in ());
}
-
- return false;
-}
-
+
+ return 0;
+} \ No newline at end of file
diff --git a/TAO/TAO_IDL/be/be_visitor_tmpl_module_inst.cpp b/TAO/TAO_IDL/be/be_visitor_tmpl_module_inst.cpp
index 0213867b7c1..96f98d8e337 100644
--- a/TAO/TAO_IDL/be/be_visitor_tmpl_module_inst.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_tmpl_module_inst.cpp
@@ -36,6 +36,8 @@
#include "fe_interface_header.h"
#include "fe_obv_header.h"
+#include "nr_extern.h"
+
be_visitor_tmpl_module_inst::be_visitor_tmpl_module_inst (
be_visitor_context *ctx)
: be_visitor_scope (ctx),
@@ -50,6 +52,10 @@ be_visitor_tmpl_module_inst::~be_visitor_tmpl_module_inst (void)
int
be_visitor_tmpl_module_inst::visit_root (be_root *node)
{
+ // We will be updating the global scope stack as required for
+ // correct implied IDL creation. The root node is already on
+ // the stack so we needn't do anything here.
+
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -65,26 +71,34 @@ be_visitor_tmpl_module_inst::visit_root (be_root *node)
int
be_visitor_tmpl_module_inst::visit_module (be_module *node)
{
- UTL_Scope *s = this->ctx_->template_module_inst_scope ();
-
// We can conveniently check this member's value to tell
// if we are (at some level )processing a template module
// instantiation.
// If so, we need to create a new module on the AST.
// When processing of the instantiation is done, the member
// is reset to 0.
- if (this->ctx_->template_args () != 0)
- {
- be_module *m = 0;
+ bool in_template_module =
+ this->ctx_->template_args () != 0;
+
+ be_module *added_module = 0;
- ACE_NEW_RETURN (m,
+ // If we are traversing a template module as a result of its
+ // instantiation, we want to create a corresponding module
+ // in the instantiated module (at the top of the scope stack),
+ // and push it on the scope stack. Otherwise, we just push
+ // the module we are visiting.
+ if (in_template_module)
+ {
+ ACE_NEW_RETURN (added_module,
be_module (node->name ()),
-1);
- s->add_to_scope (m);
- this->ctx_->template_module_inst_scope (m);
+ idl_global->scopes ().top ()->add_to_scope (added_module);
}
+ idl_global->scopes ().push (
+ in_template_module ? added_module : node);
+
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -94,8 +108,8 @@ be_visitor_tmpl_module_inst::visit_module (be_module *node)
-1);
}
- // Restore the outer adding scope.
- this->ctx_->template_module_inst_scope (s);
+ // Restore scope stack.
+ idl_global->scopes ().pop ();
return 0;
}
@@ -125,21 +139,18 @@ be_visitor_tmpl_module_inst::visit_template_module_inst (
be_template_module_inst *node)
{
this->ctx_->template_args (node->template_args ());
- UTL_Scope *s = node->defined_in ();
be_module *instance = 0;
-
ACE_NEW_RETURN (instance,
be_module (node->name ()),
-1);
// Add the new module to the scope containing the template
// module instantiation.
- s->add_to_scope (instance);
+ idl_global->scopes ().top ()->add_to_scope (instance);
- // Everything we visit in the template module below will be
- // added to the module just created.
- this->ctx_->template_module_inst_scope (instance);
+ // Update our scope management.
+ idl_global->scopes ().push (instance);
be_template_module *tm =
be_template_module::narrow_from_decl (node->ref ());
@@ -160,8 +171,8 @@ be_visitor_tmpl_module_inst::visit_template_module_inst (
// visit its scope.
this->ctx_->template_args (0);
- // Restore the outer adding scope.
- this->ctx_->template_module_inst_scope (s);
+ // Restore the scope stack.
+ idl_global->scopes ().pop ();
return 0;
}
@@ -189,10 +200,6 @@ be_visitor_tmpl_module_inst::visit_valuetype (be_valuetype *node)
this->create_name_list (node->supports (),
node->n_supports ());
- // Set the scope to our adding scope.
- UTL_Scope *s = this->ctx_->template_module_inst_scope ();
- idl_global->scopes ().push (s);
-
Identifier *node_id = 0;
ACE_NEW_RETURN (node_id,
Identifier (node->local_name ()),
@@ -256,34 +263,10 @@ be_visitor_tmpl_module_inst::visit_valuetype (be_valuetype *node)
delete supports_names;
supports_names = 0;
- // Back to reality.
- idl_global->scopes ().pop ();
-
- added_vtype->set_defined_in (s);
- added_vtype->set_imported (node->imported ());
-
- // Set repo id to 0, so it will be recomputed on the next access,
- // and set the prefix to the eventtype's prefix. All this is
- // necessary in case the eventtype's prefix was modified after
- // its declaration. We assume 'implied IDL' means that the
- // derived event consumer interface should have the same prefix.
- added_vtype->AST_Decl::repoID (0);
- added_vtype->prefix (const_cast<char*> (node->prefix ()));
-
- // Force calculation of the repo id.
- const char *dummy = added_vtype->repoID ();
-
- // For interfaces, this should always be a module or root, and
- // AST_Root is a subclass of AST_Module.
- AST_Module *m = AST_Module::narrow_from_scope (s);
-
- m->be_add_valuetype (added_vtype);
-
- // Save our containing scope for restoration later.
- be_scope *holder = this->ctx_->template_module_inst_scope ();
+ idl_global->scopes ().top ()->add_to_scope (added_vtype);
- // Update the adding scope for the interface contents.
- this->ctx_->template_module_inst_scope (added_vtype);
+ // Update the scope management.
+ idl_global->scopes ().push (added_vtype);
if (this->visit_scope (node) != 0)
{
@@ -294,8 +277,8 @@ be_visitor_tmpl_module_inst::visit_valuetype (be_valuetype *node)
-1);
}
- // Restore the previous scope.
- this->ctx_->template_module_inst_scope (holder);
+ // Through with this scope.
+ idl_global->scopes ().pop ();
// Reset the flag.
this->for_eventtype_ = false;
@@ -315,10 +298,6 @@ be_visitor_tmpl_module_inst::visit_interface (be_interface *node)
this->create_name_list (node->inherits (),
node->n_inherits ());
- // Set the scope to our adding scope.
- UTL_Scope *s = this->ctx_->template_module_inst_scope ();
- idl_global->scopes ().push (s);
-
Identifier *node_id = 0;
ACE_NEW_RETURN (node_id,
Identifier (node->local_name ()),
@@ -353,34 +332,10 @@ be_visitor_tmpl_module_inst::visit_interface (be_interface *node)
delete parent_names;
parent_names = 0;
- // Back to reality.
- idl_global->scopes ().pop ();
-
- added_iface->set_defined_in (s);
- added_iface->set_imported (node->imported ());
-
- // Set repo id to 0, so it will be recomputed on the next access,
- // and set the prefix to the eventtype's prefix. All this is
- // necessary in case the eventtype's prefix was modified after
- // its declaration. We assume 'implied IDL' means that the
- // derived event consumer interface should have the same prefix.
- added_iface->AST_Decl::repoID (0);
- added_iface->prefix (const_cast<char*> (node->prefix ()));
-
- // Force calculation of the repo id.
- const char *dummy = added_iface->repoID ();
-
- // For interfaces, this should always be a module or root, and
- // AST_Root is a subclass of AST_Module.
- AST_Module *m = AST_Module::narrow_from_scope (s);
-
- m->be_add_interface (added_iface);
-
- // Save our containing scope for restoration later.
- be_scope *holder = this->ctx_->template_module_inst_scope ();
+ idl_global->scopes ().top ()->add_to_scope (added_iface);
- // Update the adding scope for the interface contents.
- this->ctx_->template_module_inst_scope (added_iface);
+ // Update the scope stack.
+ idl_global->scopes ().push (added_iface);
if (this->visit_scope (node) != 0)
{
@@ -391,8 +346,8 @@ be_visitor_tmpl_module_inst::visit_interface (be_interface *node)
-1);
}
- // Restore the previous scope.
- this->ctx_->template_module_inst_scope (holder);
+ // Through with this scope.
+ idl_global->scopes ().pop ();
return 0;
}
@@ -413,13 +368,7 @@ be_visitor_tmpl_module_inst::visit_attribute (be_attribute *node)
node->is_abstract ()),
-1);
- be_scope *s = this->ctx_->template_module_inst_scope ();
- added_attr->set_defined_in (s);
- s->add_to_scope (added_attr);
-
- // Force recalculation of our repo ID based on the new scope.
- added_attr->repoID (0);
- const char *dummy = added_attr->repoID ();
+ idl_global->scopes ().top ()->add_to_scope (added_attr);
// These will work even if the exception lists are null.
@@ -453,11 +402,10 @@ be_visitor_tmpl_module_inst::visit_operation (be_operation *node)
node->is_abstract ()),
-1);
- be_scope *s = this->ctx_->template_module_inst_scope ();
- s->add_to_scope (added_op);
- added_op->set_defined_in (s);
+ idl_global->scopes ().top ()->add_to_scope (added_op);
- this->ctx_->template_module_inst_scope (added_op);
+ // Update the scope stack.
+ idl_global->scopes ().push (added_op);
if (this->visit_scope (node) != 0)
{
@@ -468,7 +416,8 @@ be_visitor_tmpl_module_inst::visit_operation (be_operation *node)
-1);
}
- this->ctx_->template_module_inst_scope (s);
+ // Through with this scope.
+ idl_global->scopes ().pop ();
UTL_ExceptList *new_ex =
this->reify_exception_list (node->exceptions ());
@@ -485,16 +434,14 @@ be_visitor_tmpl_module_inst::visit_argument (be_argument *node)
AST_Type::narrow_from_decl (
this->reify_type (node->field_type ()));
- be_argument *arg = 0;
- ACE_NEW_RETURN (arg,
+ be_argument *added_arg = 0;
+ ACE_NEW_RETURN (added_arg,
be_argument (node->direction (),
t,
node->name ()),
-1);
- // This method is virtual in be_scope and overridden in
- // be_operation and be_factory.
- this->ctx_->template_module_inst_scope ()->be_add_argument (arg);
+ idl_global->scopes ().top ()->add_to_scope (added_arg);
return 0;
}
@@ -519,9 +466,7 @@ be_visitor_tmpl_module_inst::visit_typedef (be_typedef *node)
false),
-1);
- be_scope *s = this->ctx_->template_module_inst_scope ();
- added_td->set_defined_in (s);
- s->add_to_scope (added_td);
+ idl_global->scopes ().top ()->add_to_scope (added_td);
return 0;
}
@@ -577,9 +522,7 @@ be_visitor_tmpl_module_inst::visit_constant (be_constant *node)
be_constant (et, new_v, node->name ()),
-1);
- be_scope *s = this->ctx_->template_module_inst_scope ();
- added_const->set_defined_in (s);
- s->add_to_scope (added_const);
+ idl_global->scopes ().top ()->add_to_scope (added_const);
return 0;
}
@@ -592,22 +535,19 @@ be_visitor_tmpl_module_inst::visit_structure (be_structure *node)
return 0;
}
+ UTL_ScopedName sn (node->name ()->last_component (), 0);
+
be_structure *added_struct = 0;
ACE_NEW_RETURN (added_struct,
- be_structure (node->name (),
+ be_structure (&sn,
node->is_local (),
node->is_abstract ()),
-1);
-
- // Hold current scope for restoration later.
- be_scope *holder = this->ctx_->template_module_inst_scope ();
-
- holder->add_to_scope (added_struct);
- added_struct->set_defined_in (holder);
-
+
+ idl_global->scopes ().top ()->add_to_scope (added_struct);
- // Store the new scope for traversal.
- this->ctx_->template_module_inst_scope (added_struct);
+ // Update our scope stack.
+ idl_global->scopes ().push (added_struct);
if (this->visit_scope (node) != 0)
{
@@ -618,8 +558,8 @@ be_visitor_tmpl_module_inst::visit_structure (be_structure *node)
-1);
}
- // Restore the outer scope.
- this->ctx_->template_module_inst_scope (holder);
+ // Through with this scope.
+ idl_global->scopes ().pop ();
return 0;
}
@@ -631,16 +571,14 @@ be_visitor_tmpl_module_inst::visit_field (be_field *node)
AST_Type::narrow_from_decl (
this->reify_type (node->field_type ()));
- be_field *f = 0;
- ACE_NEW_RETURN (f,
+ be_field *added_field = 0;
+ ACE_NEW_RETURN (added_field,
be_field (t,
node->name (),
node->visibility ()),
-1);
- be_scope *s = this->ctx_->template_module_inst_scope ();
- s->be_add_field (f);
- f->set_defined_in (s);
+ idl_global->scopes ().top ()->add_to_scope (added_field);
return 0;
}
@@ -651,16 +589,15 @@ be_visitor_tmpl_module_inst::visit_factory (be_factory *node)
Identifier id (node->local_name ()->get_string ());
UTL_ScopedName sn (&id, 0);
- be_factory *f = 0;
- ACE_NEW_RETURN (f,
+ be_factory *added_factory = 0;
+ ACE_NEW_RETURN (added_factory,
be_factory (&sn),
-1);
- be_scope *s = this->ctx_->template_module_inst_scope ();
- s->add_to_scope (f);
- f->set_defined_in (s);
+ idl_global->scopes ().top ()->add_to_scope (added_factory);
- this->ctx_->template_module_inst_scope (f);
+ // Update the scope stack.
+ idl_global->scopes ().push (added_factory);
if (this->visit_scope (node) != 0)
{
@@ -671,12 +608,13 @@ be_visitor_tmpl_module_inst::visit_factory (be_factory *node)
-1);
}
- this->ctx_->template_module_inst_scope (s);
+ // Through with this scope.
+ idl_global->scopes ().pop ();
UTL_ExceptList *reified_exceps =
this->reify_exception_list (node->exceptions ());
- f->be_add_exceptions (reified_exceps);
+ added_factory->be_add_exceptions (reified_exceps);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
index 9abdc784085..3c87b11f6f6 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_ch.cpp
@@ -109,7 +109,7 @@ be_visitor_valuetype_ch::visit_valuetype (be_valuetype *node)
}
// Dump the scoped name.
- *os << "public virtual ::";
+ *os << "public virtual ";
*os << inherited->nested_type_name (scope);
} // end of for loop
}
diff --git a/TAO/TAO_IDL/be_include/be_visitor_context.h b/TAO/TAO_IDL/be_include/be_visitor_context.h
index b76d4def3bd..476f273aa5b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_context.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_context.h
@@ -158,9 +158,6 @@ public:
FE_Utils::T_ARGLIST *template_args (void) const;
void template_args (FE_Utils::T_ARGLIST *args);
- be_scope *template_module_inst_scope (void) const;
- void template_module_inst_scope (UTL_Scope *s);
-
// = helpers
// visitors may need the actual type of the node stored in this context. We
@@ -300,10 +297,6 @@ private:
// Storage for the current template module params and args.
FE_Utils::T_PARAMLIST_INFO *template_params_;
FE_Utils::T_ARGLIST *template_args_;
-
- // Scope for adding the instantiated contents of a template
- // module.
- be_scope *template_module_inst_scope_;
};
#if defined (interface)
diff --git a/TAO/TAO_IDL/be_include/be_visitor_reifying.h b/TAO/TAO_IDL/be_include/be_visitor_reifying.h
index b046a123976..b6baf89dc80 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_reifying.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_reifying.h
@@ -27,8 +27,9 @@
#include "be_visitor_decl.h"
-class AST_Decl;
+#include "utl_scoped_name.h"
+class AST_Decl;
class be_param_holder;
class be_visitor_reifying : public be_visitor_decl
@@ -67,7 +68,7 @@ public:
virtual int visit_param_holder (be_param_holder *node);
private:
- bool declared_in_template_module (AST_Decl *d);
+ UTL_ScopedName *template_module_rel_name (AST_Decl *d);
private:
AST_Decl *reified_node_;
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
index 6e678e0b3c3..efd7d02cfb0 100644
--- a/TAO/TAO_IDL/include/idl_global.h
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -555,7 +555,7 @@ public:
void update_prefix (char *filename);
// Do repo id prefix bookkeeping when the file changes.
- UTL_ScopedName *string_to_scoped_name (char *s);
+ UTL_ScopedName *string_to_scoped_name (const char *s);
// Parses a string with double colons.
long seen_include_file_before (char *);
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index e881e4c64b2..83d7334f978 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -1191,9 +1191,9 @@ IDL_GlobalData::update_prefix (char *filename)
}
UTL_ScopedName *
-IDL_GlobalData::string_to_scoped_name (char *s)
+IDL_GlobalData::string_to_scoped_name (const char *s)
{
- char *start = s;
+ char *start = const_cast<char *> (s);
int len = 0;
UTL_ScopedName *retval = 0;
char tmp[256];
@@ -1203,6 +1203,22 @@ IDL_GlobalData::string_to_scoped_name (char *s)
// a space.
char *test = ACE_OS::strchr (start, ' ');
char *end = ACE_OS::strstr (start, "::");
+
+ // The loop below somehow doesn't cover this simple case.
+ if (test == 0 && end == 0)
+ {
+ // Simple local name.
+ Identifier *simple_id = 0;
+ ACE_NEW_RETURN (simple_id,
+ Identifier (s),
+ 0);
+
+ ACE_NEW_RETURN (retval,
+ UTL_ScopedName (simple_id, 0),
+ 0);
+
+ return retval;
+ }
if (test != 0 && test - end < 0)
{