summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-03-25 03:02:12 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2002-03-25 03:02:12 +0000
commita18e9b8ad433d0bd27451434064fa90decba9ab1 (patch)
treef2297971cda3b2fdf6b858a9a8afd0ae49b57910
parent5587600e426dc3f1f46fa6944f8bc7b0b5fd02c2 (diff)
downloadATCD-a18e9b8ad433d0bd27451434064fa90decba9ab1.tar.gz
ChangeLogTag: Sun Mar 24 20:59:07 2002 Jeff Parsons <parsons@cs.wustl.edu>
-rw-r--r--TAO/TAO_IDL/ast/ast_decl.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp103
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_decl.cpp42
-rw-r--r--TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_module/module.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_root/root.cpp108
-rw-r--r--TAO/TAO_IDL/be_include/be_array.h7
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_root/root.h6
-rw-r--r--TAO/TAO_IDL/fe/idl.yy6
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp6
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp39
14 files changed, 212 insertions, 160 deletions
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp
index 93a8cac6ed9..a897bce2a24 100644
--- a/TAO/TAO_IDL/ast/ast_decl.cpp
+++ b/TAO/TAO_IDL/ast/ast_decl.cpp
@@ -237,24 +237,6 @@ AST_Decl::compute_full_name (UTL_ScopedName *n)
this->pd_name->nconc (conc_name);
}
}
- else
- {/*
- if (this->pd_name == 0)
- {
- ACE_NEW (this->pd_name,
- UTL_ScopedName (0,
- 0));
- }
- else
- {
- UTL_ScopedName *conc_name = 0;
- ACE_NEW (conc_name,
- UTL_ScopedName (0,
- 0));
-
- this->pd_name->nconc (conc_name);
- }*/
- }
}
void
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index bb6a5aa0c39..51839a4b06e 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -31,7 +31,6 @@ ACE_RCSID (be,
"$Id$")
be_array::be_array (void)
- : tao_name_ (0)
{
}
@@ -53,76 +52,12 @@ be_array::be_array (UTL_ScopedName *n,
n,
I_TRUE),
COMMON_Base (local,
- abstract),
- tao_name_ (0)
+ abstract)
{
}
be_array::~be_array (void)
{
- if (this->tao_name_ == 0)
- delete [] tao_name_;
-}
-
-// Create a name for ourselves.
-const char*
-be_array::tao_name (void)
-{
- if (this->tao_name_ != 0)
- return this->tao_name_;
-
- be_type *bt = be_type::narrow_from_decl (this->base_type ());
-
- if (!bt)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_array::"
- "tao_name - "
- "bad base type\n"),
- 0);
- }
-
- const char prefix[] = "_tc_tao_array_";
-
- int l = (ACE_OS::strlen (bt->local_name ()->get_string ())
- + ACE_OS::strlen (this->local_name ()->get_string ()) + 1
- + sizeof (prefix)
- + 5 * this->n_dims ());
-
- ACE_NEW_RETURN (this->tao_name_, char[l], 0);
-
- ACE_OS::sprintf (this->tao_name_, "%s%s_%s",
- prefix, this->local_name ()->get_string (),
- bt->local_name ()->get_string());
-
- for (unsigned int i = 0; i < this->n_dims (); ++i)
- {
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
-
- // Dimension value.
- if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_array::"
- "tao_name - "
- "bad array dimension\n"),
- 0);
- }
-
- if (expr->ev ()->et != AST_Expression::EV_ulong)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_array::"
- "tao_name - "
- "bad dimension value\n"),
- 0);
- }
-
- char buf[16];
- ACE_OS::sprintf (buf, "_%4.4x", ((int) expr->ev ()->u.ulval));
- ACE_OS::strcat (this->tao_name_, buf);
- }
- return this->tao_name_;
}
int
@@ -149,12 +84,14 @@ be_array::create_name (void)
0);
}
- ACE_OS::sprintf (namebuf, "_tao_array_%s", bt->local_name ()->get_string ());
+ ACE_OS::sprintf (namebuf,
+ "_tao_array_%s",
+ bt->local_name ()->get_string ());
// Now append dimensions.
- for (i = 0; i < this->n_dims (); i++)
+ for (i = 0; i < this->n_dims (); ++i)
{
- AST_Expression *expr = this->dims ()[i]; // retrieve the ith
+ AST_Expression *expr = this->dims ()[i];
// Dimension value.
if ((expr == 0) || ((expr != 0) && (expr->ev () == 0)))
@@ -167,7 +104,10 @@ be_array::create_name (void)
}
if (expr->ev ()->et == AST_Expression::EV_ulong)
{
- ACE_OS::sprintf (namebuf, "%s_%d", namebuf, ((int)expr->ev ()->u.ulval));
+ ACE_OS::sprintf (namebuf,
+ "%s_%d",
+ namebuf,
+ ((int)expr->ev ()->u.ulval));
}
else
{
@@ -181,21 +121,32 @@ be_array::create_name (void)
// Now see if we have a fully scoped name and if so, generate one.
scope = be_scope::narrow_from_scope (this->defined_in ())->decl ();
+
if (scope)
{
// Make a copy of the enclosing scope's name.
- n = (UTL_ScopedName *)scope->name ()->copy () ;
+ n = (UTL_ScopedName *)scope->name ()->copy ();
+
+ Identifier *id = 0;
+ ACE_NEW_RETURN (id,
+ Identifier (ACE_OS::strdup (namebuf)),
+ -1);
+
+ UTL_ScopedName *sn = 0;
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ -1);
// Add our local name as the last component.
- n->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup (namebuf)),
- 0));
+ n->nconc (sn);
// Set the fully scoped name.
this->set_name (n);
}
else
{
// We better be not here because we must be inside some scope,
- // atleast the ROOT scope.
+ // at least the ROOT scope.
return -1;
}
@@ -212,13 +163,13 @@ be_array::gen_dimensions (TAO_OutStream *os,
unsigned long i;
// Print our dimensions.
- for (i = (slice ? 1 : 0); i < this->n_dims (); i++)
+ for (i = (slice ? 1 : 0); i < this->n_dims (); ++i)
{
// Retrieve the ith.
AST_Expression *expr = this->dims ()[i];
// Dimension value.
- if ((expr == NULL) || ((expr != NULL) && (expr->ev () == NULL)))
+ if ((expr == NULL) || ((expr != NULL) && (expr->ev () == 0)))
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_array::"
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index 6390860c9be..8ac75472559 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -665,16 +665,17 @@ be_structure::compute_size_type (void)
{
// Get the next AST decl node.
AST_Decl *d = si.item ();
+
+ if (d->node_type () == AST_Decl::NT_enum_val)
+ {
+ continue;
+ }
+
AST_Field *f = AST_Field::narrow_from_decl (d);
+ AST_Type *t = f->field_type ();
- if (f != 0)
+ if (t != 0)
{
- AST_Type *t = f->field_type ();
- // Our sizetype depends on the sizetype of our
- // members. Although previous value of sizetype may get
- // overwritten, we are guaranteed by the "size_type" call
- // that once the value reached be_decl::VARIABLE, nothing
- // else can overwrite it.
this->size_type (t->size_type ());
// While we're iterating, we might as well do this one too.
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
index 9609981b577..42a0de16d52 100644
--- a/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_array/array_ch.cpp
@@ -93,7 +93,9 @@ int be_visitor_array_ch::visit_array (be_array *node)
*os << " ";
- if (!this->ctx_->tdef ())
+ be_typedef *td = this->ctx_->tdef ();
+
+ if (td == 0)
{
// We are dealing with an anonymous array case. Generate a typedef with
// an _ prepended to the name.
diff --git a/TAO/TAO_IDL/be/be_visitor_decl.cpp b/TAO/TAO_IDL/be/be_visitor_decl.cpp
index 10e1ba650be..5fc92908f1b 100644
--- a/TAO/TAO_IDL/be/be_visitor_decl.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_decl.cpp
@@ -20,6 +20,7 @@
// ============================================================================
#include "be_visitor_decl.h"
+#include "be_visitor_sequence.h"
#include "be_visitor_context.h"
#include "be_typedef.h"
#include "be_type.h"
@@ -53,28 +54,51 @@ be_visitor_decl::gen_anonymous_base_type (be_type *bt,
// In case our container was typedef'd.
ctx.tdef (0);
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
+ int status = 0;
+
+ switch (cg_state)
+ {
+ case TAO_CodeGen::TAO_SEQUENCE_CH:
+ {
+ be_visitor_sequence_ch visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_SEQUENCE_CI:
+ {
+ be_visitor_sequence_ci visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_SEQUENCE_CS:
+ {
+ be_visitor_sequence_cs visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS:
+ {
+ be_visitor_sequence_cdr_op_cs visitor (&ctx);
+ status = bt->accept (&visitor);
+ break;
+ }
+ default:
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_decl::"
"gen_anonymous_base_type - "
- "bad visitor to anonymous abase type\n"),
+ "bad context state\n"),
-1);
- }
+ }
- if (bt->accept (visitor) == -1)
+ if (status == -1)
{
- delete visitor;
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_decl::"
"gen_anonymous_base_type - "
"anonymous base type codegen failed\n"),
-1);
}
-
- delete visitor;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp b/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp
index a0ba3f62432..9664770cbf9 100644
--- a/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_field/field_cs.cpp
@@ -127,7 +127,7 @@ be_visitor_field_cs::visit_sequence (be_sequence *node)
be_visitor_context ctx (*this->ctx_);
ctx.node (node);
ctx.state (TAO_CodeGen::TAO_SEQUENCE_CS);
- be_visitor_structure_cs visitor (&ctx);
+ be_visitor_sequence_cs visitor (&ctx);
if (node->accept (&visitor) == -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
index 9341c966799..5d65aee361d 100644
--- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp
@@ -510,7 +510,7 @@ be_visitor_module::visit_interface_fwd (be_interface_fwd *node)
case TAO_CodeGen::TAO_MODULE_ANY_OP_CH:
{
ctx.state (TAO_CodeGen::TAO_INTERFACE_FWD_ANY_OP_CH);
- be_visitor_interface_fwd_cdr_op_ch visitor (&ctx);
+ be_visitor_interface_fwd_any_op_ch visitor (&ctx);
status = node->accept (&visitor);
break;
}
@@ -848,7 +848,7 @@ be_visitor_module::visit_structure_fwd (be_structure_fwd *node)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
- "visit_interface_fwd - "
+ "visit_structure_fwd - "
"Bad context state\n"),
-1);
}
@@ -858,7 +858,7 @@ be_visitor_module::visit_structure_fwd (be_structure_fwd *node)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
- "visit_interface_fwd - "
+ "visit_structure_fwd - "
"failed to accept visitor\n"),
-1);
}
@@ -894,7 +894,7 @@ be_visitor_module::visit_union (be_union *node)
case TAO_CodeGen::TAO_MODULE_CS:
{
ctx.state (TAO_CodeGen::TAO_UNION_CS);
- be_visitor_union_ci visitor (&ctx);
+ be_visitor_union_cs visitor (&ctx);
status = node->accept (&visitor);
break;
}
@@ -996,7 +996,7 @@ be_visitor_module::visit_union_fwd (be_union_fwd *node)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
- "visit_interface_fwd - "
+ "visit_union_fwd - "
"Bad context state\n"),
-1);
}
@@ -1006,7 +1006,7 @@ be_visitor_module::visit_union_fwd (be_union_fwd *node)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_module::"
- "visit_interface_fwd - "
+ "visit_union_fwd - "
"failed to accept visitor\n"),
-1);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_root.cpp b/TAO/TAO_IDL/be/be_visitor_root.cpp
index e817d94d311..f50ee1cb45e 100644
--- a/TAO/TAO_IDL/be/be_visitor_root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root.cpp
@@ -24,8 +24,10 @@
#include "be_module.h"
#include "be_root.h"
#include "be_structure.h"
+#include "be_structure_fwd.h"
#include "be_typedef.h"
#include "be_union.h"
+#include "be_union_fwd.h"
#include "be_valuetype.h"
#include "be_valuetype_fwd.h"
#include "be_helper.h"
@@ -39,8 +41,10 @@
#include "be_visitor_interface_fwd.h"
#include "be_visitor_module.h"
#include "be_visitor_structure.h"
+#include "be_visitor_structure_fwd.h"
#include "be_visitor_typedef.h"
#include "be_visitor_union.h"
+#include "be_visitor_union_fwd.h"
#include "be_visitor_valuetype.h"
#include "be_visitor_valuetype_fwd.h"
#include "be_visitor_context.h"
diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
index bd676128b11..82316d23899 100644
--- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp
@@ -1227,6 +1227,59 @@ be_visitor_root::visit_structure (be_structure *node)
}
int
+be_visitor_root::visit_structure_fwd (be_structure_fwd *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_STRUCT_FWD_CH);
+ be_visitor_structure_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_CS:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_structure_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_structure_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
be_visitor_root::visit_union (be_union *node)
{
// Instantiate a visitor context with a copy of our context. This info
@@ -1254,7 +1307,7 @@ be_visitor_root::visit_union (be_union *node)
case TAO_CodeGen::TAO_ROOT_CS:
{
ctx.state (TAO_CodeGen::TAO_UNION_CS);
- be_visitor_union_ci visitor (&ctx);
+ be_visitor_union_cs visitor (&ctx);
status = node->accept (&visitor);
break;
}
@@ -1322,6 +1375,59 @@ be_visitor_root::visit_union (be_union *node)
}
int
+be_visitor_root::visit_union_fwd (be_union_fwd *node)
+{
+ // Instantiate a visitor context with a copy of our context. This info
+ // will be modified based on what type of node we are visiting.
+ be_visitor_context ctx (*this->ctx_);
+ ctx.node (node);
+ int status = 0;
+
+ switch (this->ctx_->state ())
+ {
+ case TAO_CodeGen::TAO_ROOT_CH:
+ {
+ ctx.state (TAO_CodeGen::TAO_UNION_FWD_CH);
+ be_visitor_union_fwd_ch visitor (&ctx);
+ status = node->accept (&visitor);
+ break;
+ }
+ case TAO_CodeGen::TAO_ROOT_CI:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CI:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CH:
+ case TAO_CodeGen::TAO_ROOT_CDR_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_ANY_OP_CS:
+ case TAO_CodeGen::TAO_ROOT_CS:
+ case TAO_CodeGen::TAO_ROOT_SH:
+ case TAO_CodeGen::TAO_ROOT_SI:
+ case TAO_CodeGen::TAO_ROOT_SS:
+ case TAO_CodeGen::TAO_ROOT_IH:
+ case TAO_CodeGen::TAO_ROOT_IS:
+ return 0; // nothing to be done
+ default:
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_union_fwd - "
+ "Bad context state\n"),
+ -1);
+ }
+ }
+
+ if (status == -1)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_root::"
+ "visit_interface_fwd - "
+ "failed to accept visitor\n"),
+ -1);
+ }
+
+ return 0;
+}
+
+int
be_visitor_root::visit_typedef (be_typedef *node)
{
// Instantiate a visitor context with a copy of our context. This info
diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h
index a70776479fa..87193cc5f0a 100644
--- a/TAO/TAO_IDL/be_include/be_array.h
+++ b/TAO/TAO_IDL/be_include/be_array.h
@@ -63,13 +63,6 @@ protected:
virtual int create_name (void);
// Create a name for us.
-
- const char* tao_name (void);
-
-private:
- char* tao_name_;
- // We need a name to generate typecodes and other objects, but it
- // must be different from the typedef name.
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_visitor_root/root.h b/TAO/TAO_IDL/be_include/be_visitor_root/root.h
index 7a720753fc4..cb95595d55b 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_root/root.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_root/root.h
@@ -72,9 +72,15 @@ public:
virtual int visit_structure (be_structure *node);
// visit a structure
+ virtual int visit_structure_fwd (be_structure_fwd *node);
+ // visit a forward declared structure
+
virtual int visit_union (be_union *node);
// visit a union
+ virtual int visit_union_fwd (be_union_fwd *node);
+ // visit a forward declared union
+
virtual int visit_typedef (be_typedef *node);
// visit the typedef node
diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy
index 3bd111d1ccf..226a06e85b4 100644
--- a/TAO/TAO_IDL/fe/idl.yy
+++ b/TAO/TAO_IDL/fe/idl.yy
@@ -1945,8 +1945,10 @@ complex_declarator :
// complex_declarator : array_declarator
UTL_ScopedName *sn = 0;
ACE_NEW_RETURN (sn,
- UTL_ScopedName ($1->local_name (),
- 0),
+ UTL_ScopedName (
+ $1->local_name ()->copy (),
+ 0
+ ),
1);
ACE_NEW_RETURN ($$,
FE_Declarator (sn,
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp
index 2366531e8b0..a6bad14ab4d 100644
--- a/TAO/TAO_IDL/fe/y.tab.cpp
+++ b/TAO/TAO_IDL/fe/y.tab.cpp
@@ -2943,8 +2943,10 @@ case 194:
/* complex_declarator : array_declarator*/
UTL_ScopedName *sn = 0;
ACE_NEW_RETURN (sn,
- UTL_ScopedName (tao_yyvsp[0].dcval->local_name (),
- 0),
+ UTL_ScopedName (
+ tao_yyvsp[0].dcval->local_name ()->copy (),
+ 0
+ ),
1);
ACE_NEW_RETURN (tao_yyval.deval,
FE_Declarator (sn,
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index c4663212af5..0de35907366 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -407,8 +407,10 @@ UTL_Scope::redef_clash (AST_Decl::NodeType new_nt,
case AST_Decl::NT_union_fwd:
return scope_elem_nt != AST_Decl::NT_union_fwd;
case AST_Decl::NT_interface:
- case AST_Decl::NT_interface_fwd:
return scope_elem_nt != AST_Decl::NT_interface_fwd;
+ case AST_Decl::NT_interface_fwd:
+ return (scope_elem_nt != AST_Decl::NT_interface_fwd
+ && scope_elem_nt != AST_Decl::NT_interface);
default:
return I_TRUE;
}
@@ -1743,8 +1745,8 @@ UTL_Scope::add_to_scope (AST_Decl *e,
return;
}
- AST_Decl **tmp = this->pd_referenced;
- long i = this->pd_referenced_used;
+ AST_Decl **tmp = this->pd_decls;
+ long i = this->pd_decls_used;
Identifier *decl_name = e->local_name ();
char *decl_string = decl_name->get_string ();
@@ -1757,34 +1759,11 @@ UTL_Scope::add_to_scope (AST_Decl *e,
// in this scope.
for (; i > 0; i--, tmp++)
{
- if ((*tmp)->defined_in () == this)
- {
- // A local declaration doesn't use a scoped name.
- ref_name = (*tmp)->local_name ();
- ref_string = ref_name->get_string ();
- }
- else
- {
- // If this item is merely referenced in this scope,
- // then only the top level of whatever scoped name
- // is used may clash with a local declaration.
- UTL_ScopedName *s = (*tmp)->name ();
- UTL_IdListActiveIterator iter (s);
- ref_name = iter.item ();
- ref_string = ref_name->get_string ();
-
- // Get the first non-null component of the scoped
- // nane that's not the global double colon.
- while (!ACE_OS::strcmp (ref_string, "")
- || !ACE_OS::strcmp (ref_string, "::"))
- {
- iter.next ();
- ref_name = iter.item ();
- ref_string = ref_name->get_string ();
- }
- }
+ // A local declaration doesn't use a scoped name.
+ ref_name = (*tmp)->local_name ();
+ ref_string = ref_name->get_string ();
- // If the names compare exactly, it's a redefinition
+ // If the names compare exactly, it's a redefini8tion
// error, unless they're both modules (which can be
// reopened) or we have a belated definition of a
// forward-declared interface.