summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/ast/ast_structure.cpp
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-06-15 18:56:10 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-06-15 18:56:10 +0000
commit535b0cc71b467d95736eea8e9e778e4bbc4c219b (patch)
treee277eb69bd06fc41160331de91494d950eb3a978 /TAO/TAO_IDL/ast/ast_structure.cpp
parent16ca54df56baba2206df610d38e5a3143b8c1ce9 (diff)
downloadATCD-535b0cc71b467d95736eea8e9e778e4bbc4c219b.tar.gz
ChangeLogTag: Thu Jun 15 15:05:43 UTC 2006 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'TAO/TAO_IDL/ast/ast_structure.cpp')
-rw-r--r--TAO/TAO_IDL/ast/ast_structure.cpp43
1 files changed, 39 insertions, 4 deletions
diff --git a/TAO/TAO_IDL/ast/ast_structure.cpp b/TAO/TAO_IDL/ast/ast_structure.cpp
index dbcc25a7beb..e5f83a1c0b8 100644
--- a/TAO/TAO_IDL/ast/ast_structure.cpp
+++ b/TAO/TAO_IDL/ast/ast_structure.cpp
@@ -89,7 +89,8 @@ AST_Structure::AST_Structure (void)
AST_ConcreteType (),
UTL_Scope (),
member_count_ (-1),
- local_struct_ (-1)
+ local_struct_ (-1),
+ fwd_decl_ (0)
{
}
@@ -106,7 +107,8 @@ AST_Structure::AST_Structure (UTL_ScopedName *n,
n),
UTL_Scope (AST_Decl::NT_struct),
member_count_ (-1),
- local_struct_ (-1)
+ local_struct_ (-1),
+ fwd_decl_ (0)
{
}
@@ -124,7 +126,8 @@ AST_Structure::AST_Structure (AST_Decl::NodeType nt,
n),
UTL_Scope (nt),
member_count_ (-1),
- local_struct_ (-1)
+ local_struct_ (-1),
+ fwd_decl_ (0)
{
}
@@ -277,6 +280,12 @@ AST_Structure::contains_wstring (void)
}
bool
+AST_Structure::is_defined (void)
+{
+ return 0 == this->fwd_decl_ || this->fwd_decl_->is_defined ();
+}
+
+bool
AST_Structure::legal_for_primary_key (void) const
{
bool retval = true;
@@ -305,6 +314,18 @@ AST_Structure::legal_for_primary_key (void) const
return retval;
}
+AST_StructureFwd *
+AST_Structure::fwd_decl (void) const
+{
+ return this->fwd_decl_;
+}
+
+void
+AST_Structure::fwd_decl (AST_StructureFwd *node)
+{
+ this->fwd_decl_ = node;
+}
+
// Private operations.
// Add this AST_Field node (a field declaration) to this scope.
@@ -673,8 +694,20 @@ AST_Structure::fwd_redefinition_helper (AST_Structure *&i,
}
fd->redefine (i);
+ AST_StructureFwd *fwd = fd->fwd_decl ();
+
+ if (0 != fwd)
+ {
+ // So the fwd decl won't destroy us at cleanup time.
+ // Unlike interfaces, valuetypes and components, it's
+ // ok to do this here, since fwd declared structs
+ // and unions must be defined in the same translation
+ // unit.
+ fwd->set_as_defined ();
+ }
// Use full definition node.
+ i->destroy ();
delete i;
i = fd;
}
@@ -687,7 +720,7 @@ void
AST_Structure::redefine (AST_Structure *from)
{
// We've already checked for inconsistent prefixes.
- this->prefix (ACE::strnew (from->prefix ()));
+ this->prefix (from->prefix ());
this->set_defined_in (from->defined_in ());
this->set_imported (idl_global->imported ());
@@ -747,6 +780,8 @@ AST_Structure::ast_accept (ast_visitor *visitor)
void
AST_Structure::destroy (void)
{
+ this->AST_ConcreteType::destroy ();
+ this->UTL_Scope::destroy ();
}
// Narrowing.