summaryrefslogtreecommitdiff
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
commit3c995cdc91898efce06c0e809ae5ecae4b392ed3 (patch)
treee277eb69bd06fc41160331de91494d950eb3a978
parenta5a90e347b625d229fbf3a3698998182ba0c2957 (diff)
downloadATCD-3c995cdc91898efce06c0e809ae5ecae4b392ed3.tar.gz
ChangeLogTag: Thu Jun 15 15:05:43 UTC 2006 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/TAO_IDL/ast/ast_argument.cpp6
-rw-r--r--TAO/TAO_IDL/ast/ast_array.cpp43
-rw-r--r--TAO/TAO_IDL/ast/ast_attribute.cpp23
-rw-r--r--TAO/TAO_IDL/ast/ast_check.cpp8
-rw-r--r--TAO/TAO_IDL/ast/ast_concrete_type.cpp6
-rw-r--r--TAO/TAO_IDL/ast/ast_constant.cpp2
-rw-r--r--TAO/TAO_IDL/ast/ast_decl.cpp33
-rw-r--r--TAO/TAO_IDL/ast/ast_enum.cpp11
-rw-r--r--TAO/TAO_IDL/ast/ast_exception.cpp6
-rw-r--r--TAO/TAO_IDL/ast/ast_expression.cpp266
-rw-r--r--TAO/TAO_IDL/ast/ast_factory.cpp14
-rw-r--r--TAO/TAO_IDL/ast/ast_field.cpp34
-rw-r--r--TAO/TAO_IDL/ast/ast_generator.cpp240
-rw-r--r--TAO/TAO_IDL/ast/ast_home.cpp38
-rw-r--r--TAO/TAO_IDL/ast/ast_interface.cpp98
-rw-r--r--TAO/TAO_IDL/ast/ast_interface_fwd.cpp119
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp62
-rw-r--r--TAO/TAO_IDL/ast/ast_native.cpp6
-rw-r--r--TAO/TAO_IDL/ast/ast_operation.cpp26
-rw-r--r--TAO/TAO_IDL/ast/ast_predefined_type.cpp2
-rw-r--r--TAO/TAO_IDL/ast/ast_root.cpp55
-rw-r--r--TAO/TAO_IDL/ast/ast_sequence.cpp42
-rw-r--r--TAO/TAO_IDL/ast/ast_string.cpp2
-rw-r--r--TAO/TAO_IDL/ast/ast_structure.cpp43
-rw-r--r--TAO/TAO_IDL/ast/ast_structure_fwd.cpp24
-rw-r--r--TAO/TAO_IDL/ast/ast_type.cpp3
-rw-r--r--TAO/TAO_IDL/ast/ast_typedef.cpp20
-rw-r--r--TAO/TAO_IDL/ast/ast_union_branch.cpp10
-rw-r--r--TAO/TAO_IDL/ast/ast_union_label.cpp14
-rw-r--r--TAO/TAO_IDL/ast/ast_valuebox.cpp6
-rw-r--r--TAO/TAO_IDL/ast/ast_valuetype.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_argument.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_array.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_attribute.cpp21
-rw-r--r--TAO/TAO_IDL/be/be_codegen.cpp129
-rw-r--r--TAO/TAO_IDL/be/be_constant.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_enum.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_exception.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_factory.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_field.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_generator.cpp238
-rw-r--r--TAO/TAO_IDL/be/be_global.cpp452
-rw-r--r--TAO/TAO_IDL/be/be_home.cpp17
-rw-r--r--TAO/TAO_IDL/be/be_init.cpp18
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_interface_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_interface_strategy.cpp550
-rw-r--r--TAO/TAO_IDL/be/be_module.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_native.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_operation.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_operation_strategy.cpp98
-rw-r--r--TAO/TAO_IDL/be/be_predefined_type.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_produce.cpp255
-rw-r--r--TAO/TAO_IDL/be/be_root.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_scope.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_sequence.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_string.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_structure.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_structure_fwd.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_union.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_union_fwd.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_union_label.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_valuetype.cpp11
-rw-r--r--TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp195
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp490
-rw-r--r--TAO/TAO_IDL/be/be_visitor_arg_traits.cpp20
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp73
-rw-r--r--TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp124
-rw-r--r--TAO/TAO_IDL/be/be_visitor_context.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_decl.cpp8
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp35
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp72
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface.cpp7
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp44
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp30
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp5
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp118
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp151
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp19
-rw-r--r--TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp45
-rw-r--r--TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp3
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype.cpp1
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp59
-rw-r--r--TAO/TAO_IDL/be_include/be_argument.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_array.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_attribute.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_codegen.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_extern.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_field.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_generator.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_global.h42
-rw-r--r--TAO/TAO_IDL/be_include/be_interface.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_interface_strategy.h64
-rw-r--r--TAO/TAO_IDL/be_include/be_native.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_operation_strategy.h36
-rw-r--r--TAO/TAO_IDL/be_include/be_root.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_union_branch.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_union_label.h3
-rw-r--r--TAO/TAO_IDL/be_include/be_valuebox.h2
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor.h1
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h6
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_decl.h11
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h50
-rw-r--r--TAO/TAO_IDL/driver/drv_args.cpp120
-rw-r--r--TAO/TAO_IDL/driver/drv_preproc.cpp236
-rw-r--r--TAO/TAO_IDL/fe/fe_declarator.cpp2
-rw-r--r--TAO/TAO_IDL/fe/fe_extern.cpp2
-rw-r--r--TAO/TAO_IDL/fe/fe_init.cpp4
-rw-r--r--TAO/TAO_IDL/fe/fe_interface_header.cpp94
-rw-r--r--TAO/TAO_IDL/fe/idl.ll10
-rw-r--r--TAO/TAO_IDL/fe/idl.yy723
-rw-r--r--TAO/TAO_IDL/fe/lex.yy.cpp35
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp755
-rw-r--r--TAO/TAO_IDL/fe/y.tab.cpp.diff2
-rw-r--r--TAO/TAO_IDL/fe/y.tab.h2
-rw-r--r--TAO/TAO_IDL/include/ast_argument.h3
-rw-r--r--TAO/TAO_IDL/include/ast_array.h9
-rw-r--r--TAO/TAO_IDL/include/ast_attribute.h3
-rw-r--r--TAO/TAO_IDL/include/ast_concrete_type.h3
-rw-r--r--TAO/TAO_IDL/include/ast_decl.h7
-rw-r--r--TAO/TAO_IDL/include/ast_exception.h3
-rw-r--r--TAO/TAO_IDL/include/ast_expression.h3
-rw-r--r--TAO/TAO_IDL/include/ast_field.h13
-rw-r--r--TAO/TAO_IDL/include/ast_generator.h68
-rw-r--r--TAO/TAO_IDL/include/ast_interface.h12
-rw-r--r--TAO/TAO_IDL/include/ast_interface_fwd.h6
-rw-r--r--TAO/TAO_IDL/include/ast_native.h3
-rw-r--r--TAO/TAO_IDL/include/ast_sequence.h7
-rw-r--r--TAO/TAO_IDL/include/ast_structure.h12
-rw-r--r--TAO/TAO_IDL/include/ast_structure_fwd.h6
-rw-r--r--TAO/TAO_IDL/include/ast_typedef.h4
-rw-r--r--TAO/TAO_IDL/include/ast_union_branch.h3
-rw-r--r--TAO/TAO_IDL/include/ast_union_label.h3
-rw-r--r--TAO/TAO_IDL/include/ast_valuebox.h4
-rw-r--r--TAO/TAO_IDL/include/drv_extern.h2
-rw-r--r--TAO/TAO_IDL/include/fe_extern.h8
-rw-r--r--TAO/TAO_IDL/include/idl_global.h17
-rw-r--r--TAO/TAO_IDL/include/utl_exceptlist.h7
-rw-r--r--TAO/TAO_IDL/include/utl_exprlist.h3
-rw-r--r--TAO/TAO_IDL/include/utl_labellist.h3
-rw-r--r--TAO/TAO_IDL/include/utl_list.h1
-rw-r--r--TAO/TAO_IDL/include/utl_namelist.h3
-rw-r--r--TAO/TAO_IDL/include/utl_scope.h6
-rw-r--r--TAO/TAO_IDL/tao_idl.cpp222
-rw-r--r--TAO/TAO_IDL/util/utl_exceptlist.cpp35
-rw-r--r--TAO/TAO_IDL/util/utl_exprlist.cpp20
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp129
-rw-r--r--TAO/TAO_IDL/util/utl_idlist.cpp1
-rw-r--r--TAO/TAO_IDL/util/utl_labellist.cpp11
-rw-r--r--TAO/TAO_IDL/util/utl_list.cpp1
-rw-r--r--TAO/TAO_IDL/util/utl_namelist.cpp10
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp172
-rw-r--r--TAO/TAO_IDL/util/utl_string.cpp11
168 files changed, 4980 insertions, 2958 deletions
diff --git a/TAO/TAO_IDL/ast/ast_argument.cpp b/TAO/TAO_IDL/ast/ast_argument.cpp
index 3d916a79a2f..0847850d552 100644
--- a/TAO/TAO_IDL/ast/ast_argument.cpp
+++ b/TAO/TAO_IDL/ast/ast_argument.cpp
@@ -136,6 +136,12 @@ AST_Argument::ast_accept (ast_visitor *visitor)
return visitor->visit_argument (this);
}
+void
+AST_Argument::destroy (void)
+{
+ this->AST_Field::destroy ();
+}
+
AST_Argument::Direction
AST_Argument::direction (void)
{
diff --git a/TAO/TAO_IDL/ast/ast_array.cpp b/TAO/TAO_IDL/ast/ast_array.cpp
index a34026cedee..9f602b8633a 100644
--- a/TAO/TAO_IDL/ast/ast_array.cpp
+++ b/TAO/TAO_IDL/ast/ast_array.cpp
@@ -91,7 +91,8 @@ AST_Array::AST_Array (void)
AST_ConcreteType (),
pd_n_dims (0),
pd_dims (0),
- pd_base_type (0)
+ pd_base_type (0),
+ owns_base_type_ (false)
{
}
@@ -110,7 +111,8 @@ AST_Array::AST_Array (UTL_ScopedName *n,
AST_ConcreteType (AST_Decl::NT_array,
n),
pd_n_dims (nd),
- pd_base_type (0)
+ pd_base_type (0),
+ owns_base_type_ (false)
{
this->pd_dims = this->compute_dims (ds,
nd);
@@ -144,7 +146,13 @@ AST_Array::compute_dims (UTL_ExprList *ds,
!iter.is_done () && i < nds;
iter.next (), i++)
{
- result[i] = iter.item ();
+ AST_Expression *orig = iter.item ();
+ AST_Expression *copy = 0;
+ ACE_NEW_RETURN (copy,
+ AST_Expression (orig,
+ orig->ev ()->et),
+ 0);
+ result[i] = copy;
}
return result;
@@ -225,6 +233,11 @@ AST_Array::set_base_type (AST_Type *nbt)
this->pd_base_type = nbt;
this->is_local_ = nbt->is_local ();
+
+ if (AST_Decl::NT_sequence == nbt->node_type ())
+ {
+ this->owns_base_type_ = true;
+ }
}
bool
@@ -234,6 +247,30 @@ AST_Array::legal_for_primary_key (void) const
}
void
+AST_Array::destroy (void)
+{
+ if (this->owns_base_type_)
+ {
+ this->pd_base_type->destroy ();
+ delete this->pd_base_type;
+ this->pd_base_type = 0;
+ }
+
+ for (unsigned long i = 0; i < this->pd_n_dims; ++i)
+ {
+ this->pd_dims[i]->destroy ();
+ delete this->pd_dims[i];
+ this->pd_dims[i] = 0;
+ }
+
+ delete [] this->pd_dims;
+ this->pd_dims = 0;
+ this->pd_n_dims = 0;
+
+ this->AST_ConcreteType::destroy ();
+}
+
+void
AST_Array::set_dims (AST_Expression **ds,
unsigned long nds)
{
diff --git a/TAO/TAO_IDL/ast/ast_attribute.cpp b/TAO/TAO_IDL/ast/ast_attribute.cpp
index bbc7f6deec5..f85b62ed9fc 100644
--- a/TAO/TAO_IDL/ast/ast_attribute.cpp
+++ b/TAO/TAO_IDL/ast/ast_attribute.cpp
@@ -133,6 +133,29 @@ AST_Attribute::ast_accept (ast_visitor *visitor)
return visitor->visit_attribute (this);
}
+void
+AST_Attribute::destroy (void)
+{
+ // No need to delete our exception lists, the
+ // destroy() method does it. The UTL_ExceptList
+ // destroy() method does NOT delete the contained
+ // exception nodes.
+
+ if (this->pd_get_exceptions != 0)
+ {
+ this->pd_get_exceptions->destroy ();
+ this->pd_get_exceptions = 0;
+ }
+
+ if (this->pd_set_exceptions != 0)
+ {
+ this->pd_set_exceptions->destroy ();
+ this->pd_set_exceptions = 0;
+ }
+
+ this->AST_Field::destroy ();
+}
+
UTL_ExceptList *
AST_Attribute::be_add_get_exceptions (UTL_ExceptList *t)
{
diff --git a/TAO/TAO_IDL/ast/ast_check.cpp b/TAO/TAO_IDL/ast/ast_check.cpp
index 3f931e86174..a4c1afcc73d 100644
--- a/TAO/TAO_IDL/ast/ast_check.cpp
+++ b/TAO/TAO_IDL/ast/ast_check.cpp
@@ -135,4 +135,12 @@ AST_check_fwd_decls (void)
idl_global->err ()->fwd_decl_not_defined (d);
}
}
+
+ // This method is called once per file in the command line,
+ // in between which the elements of ast_fwds are destroyed,
+ // so we have to clean up.
+ delete [] ast_fwds;
+ ast_fwds = 0;
+ ast_n_fwds_alloc = 0;
+ ast_n_fwds_used = 0;
}
diff --git a/TAO/TAO_IDL/ast/ast_concrete_type.cpp b/TAO/TAO_IDL/ast/ast_concrete_type.cpp
index 833bd44af84..ce30ecfff39 100644
--- a/TAO/TAO_IDL/ast/ast_concrete_type.cpp
+++ b/TAO/TAO_IDL/ast/ast_concrete_type.cpp
@@ -95,6 +95,12 @@ AST_ConcreteType::~AST_ConcreteType (void)
{
}
+void
+AST_ConcreteType::destroy (void)
+{
+ this->AST_Type::destroy ();
+}
+
// Narrowing methods.
IMPL_NARROW_METHODS1(AST_ConcreteType, AST_Type)
IMPL_NARROW_FROM_DECL(AST_ConcreteType)
diff --git a/TAO/TAO_IDL/ast/ast_constant.cpp b/TAO/TAO_IDL/ast/ast_constant.cpp
index 6a73e6d8e9a..2ff7bad52cd 100644
--- a/TAO/TAO_IDL/ast/ast_constant.cpp
+++ b/TAO/TAO_IDL/ast/ast_constant.cpp
@@ -220,6 +220,8 @@ AST_Constant::destroy (void)
delete this->pd_constant_value;
this->pd_constant_value = 0;
}
+
+ this->AST_Decl::destroy ();
}
// Data accessors.
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp
index 7283af70e0b..314b17dba58 100644
--- a/TAO/TAO_IDL/ast/ast_decl.cpp
+++ b/TAO/TAO_IDL/ast/ast_decl.cpp
@@ -106,18 +106,30 @@ COMMON_Base::COMMON_Base (bool local,
}
bool
-COMMON_Base::is_local (void)
+COMMON_Base::is_local (void) const
{
return this->is_local_;
}
+void
+COMMON_Base::is_local (bool val)
+{
+ this->is_local_ = val;
+}
+
bool
-COMMON_Base::is_abstract (void)
+COMMON_Base::is_abstract (void) const
{
return this->is_abstract_;
}
void
+COMMON_Base::is_abstract (bool val)
+{
+ this->is_abstract_ = val;
+}
+
+void
COMMON_Base::destroy (void)
{
}
@@ -819,6 +831,13 @@ AST_Decl::destroy (void)
this->pd_original_local_name = 0;
}
+ if (this->last_referenced_as_ != 0)
+ {
+ this->last_referenced_as_->destroy ();
+ delete this->last_referenced_as_;
+ this->last_referenced_as_ = 0;
+ }
+
delete [] this->full_name_;
this->full_name_ = 0;
@@ -853,6 +872,7 @@ AST_Decl::repoID (void)
{
if (this->pd_node_type == NT_root)
{
+ delete [] this->repoID_;
this->repoID_ = ACE::strnew ("");
}
@@ -870,7 +890,6 @@ AST_Decl::repoID (char *value)
if (this->repoID_ != 0)
{
delete [] this->repoID_;
- this->repoID_ = 0;
}
this->repoID_ = value;
@@ -1032,7 +1051,7 @@ AST_Decl::set_id_with_typeid (char *value)
delete [] this->repoID_;
this->repoID_ = 0;
- this->repoID (value);
+ this->repoID (ACE::strnew (value));
this->typeid_set_ = true;
}
@@ -1345,6 +1364,12 @@ AST_Decl::last_referenced_as (void) const
void
AST_Decl::last_referenced_as (UTL_ScopedName *n)
{
+ if (this->last_referenced_as_ != 0)
+ {
+ this->last_referenced_as_->destroy ();
+ }
+
+ delete this->last_referenced_as_;
this->last_referenced_as_ = n;
}
diff --git a/TAO/TAO_IDL/ast/ast_enum.cpp b/TAO/TAO_IDL/ast/ast_enum.cpp
index cb18dc00c99..37837f7e5a0 100644
--- a/TAO/TAO_IDL/ast/ast_enum.cpp
+++ b/TAO/TAO_IDL/ast/ast_enum.cpp
@@ -241,11 +241,14 @@ AST_Enum::fe_add_enum_val (AST_EnumVal *t)
if (t != 0)
{
- unsigned long tmp =
- t->constant_value ()->coerce (AST_Expression::EV_ulong)->u.ulval;
+ AST_Expression::AST_ExprValue *ev =
+ t->constant_value ()->coerce (AST_Expression::EV_ulong);
- t1 = idl_global->gen ()->create_enum_val (tmp,
+ t1 = idl_global->gen ()->create_enum_val (ev->u.ulval,
t->name ());
+
+ delete ev;
+ ev = 0;
UTL_ScopedName *sn =
munge_name_for_enumval ((UTL_IdList *) t->name ()->copy (),
@@ -353,7 +356,7 @@ void
AST_Enum::destroy (void)
{
this->UTL_Scope::destroy ();
- this->AST_Decl::destroy ();
+ this->AST_ConcreteType::destroy ();
}
diff --git a/TAO/TAO_IDL/ast/ast_exception.cpp b/TAO/TAO_IDL/ast/ast_exception.cpp
index 62a91cd53e4..8f03d1bda61 100644
--- a/TAO/TAO_IDL/ast/ast_exception.cpp
+++ b/TAO/TAO_IDL/ast/ast_exception.cpp
@@ -434,6 +434,12 @@ AST_Exception::ast_accept (ast_visitor *visitor)
return visitor->visit_exception (this);
}
+void
+AST_Exception::destroy (void)
+{
+ this->AST_Structure::destroy ();
+}
+
// Narrowing methods.
IMPL_NARROW_METHODS1(AST_Exception, AST_Structure)
IMPL_NARROW_FROM_DECL(AST_Exception)
diff --git a/TAO/TAO_IDL/ast/ast_expression.cpp b/TAO/TAO_IDL/ast/ast_expression.cpp
index 285f4cfca7f..2591325814a 100644
--- a/TAO/TAO_IDL/ast/ast_expression.cpp
+++ b/TAO/TAO_IDL/ast/ast_expression.cpp
@@ -91,7 +91,7 @@ AST_Expression::fill_definition_details (void)
? idl_global->scopes().top ()
: 0 ;
this->pd_line = idl_global->lineno ();
- this->pd_file_name = idl_global->filename ();
+ this->pd_file_name = idl_global->filename ();
}
// Constructor(s) and destructor.
@@ -119,13 +119,43 @@ AST_Expression::AST_Expression (AST_Expression *v,
tdef (0)
{
this->fill_definition_details ();
+
+ // If we are here because one string constant has
+ // another one as its rhs, we must copy the UTL_String
+ // so both can be destroyed at cleanup.
+ if (EV_string == t)
+ {
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ ACE_NEW (this->pd_ev->u.strval,
+ UTL_String (v->pd_ev->u.strval));
- this->pd_ev = v->coerce (t);
-
- if (this->pd_ev == 0)
+ this->pd_ev->et = EV_string;
+ }
+ else if (EV_wstring == t)
+ {
+ ACE_NEW (this->pd_ev,
+ AST_ExprValue);
+
+ this->pd_ev->u.wstrval = ACE::strnew (v->pd_ev->u.wstrval);
+ this->pd_ev->et = EV_string;
+ }
+ else
{
- idl_global->err ()->coercion_error (v,
- t);
+ this->pd_ev = v->coerce (t);
+
+ if (this->pd_ev == 0)
+ {
+ idl_global->err ()->coercion_error (v,
+ t);
+ }
+
+ if (0 != v->pd_n)
+ {
+ this->pd_n =
+ dynamic_cast<UTL_ScopedName *> (v->pd_n->copy ());
+ }
}
}
@@ -360,9 +390,13 @@ AST_Expression::AST_Expression (UTL_String *sv)
ACE_NEW (this->pd_ev,
AST_ExprValue);
+
+ UTL_String *new_str = 0;
+ ACE_NEW (new_str,
+ UTL_String (sv));
+ this->pd_ev->u.strval = new_str;
this->pd_ev->et = EV_string;
- this->pd_ev->u.strval = sv;
}
// An AST_Expression denoting a wide string.
@@ -389,6 +423,8 @@ AST_Expression::~AST_Expression (void)
AST_Expression::AST_ExprValue::AST_ExprValue (void)
{
+ this->u.ulval = 0UL;
+ this->et = AST_Expression::EV_none;
}
// Static operations.
@@ -414,7 +450,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_ushort:
if (ev->u.usval > (unsigned short) ACE_INT16_MAX)
{
- return 0;
+ return 0;
}
ev->u.sval = (short) ev->u.usval;
@@ -424,7 +460,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
if (ev->u.lval > (long) ACE_INT16_MAX
|| ev->u.lval < (long) ACE_INT16_MIN)
{
- return 0;
+ return 0;
}
ev->u.sval = (short) ev->u.lval;
@@ -433,7 +469,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
case AST_Expression::EV_ulong:
if (ev->u.ulval > (unsigned long) ACE_INT16_MAX)
{
- return 0;
+ return 0;
}
ev->u.sval = (short) ev->u.ulval;
@@ -444,7 +480,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
if (ev->u.llval > (ACE_CDR::LongLong) ACE_INT16_MAX
|| ev->u.llval < (ACE_CDR::LongLong) ACE_INT16_MIN)
{
- return 0;
+ return 0;
}
ev->u.sval = (short) ev->u.llval;
@@ -457,7 +493,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
#if ! defined (ACE_LACKS_LONGLONG_T)
if ((ev->u.ullval & ACE_INT16_MAX) != ev->u.ullval)
{
- return 0;
+ return 0;
}
ev->u.sval = (short) ev->u.ullval;
@@ -474,7 +510,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
if (ev->u.fval > (float) ACE_INT16_MAX
|| ev->u.fval < (float) ACE_INT16_MIN)
{
- return 0;
+ return 0;
}
ev->u.sval = (short) ev->u.fval;
@@ -484,7 +520,7 @@ coerce_value (AST_Expression::AST_ExprValue *ev,
if (ev->u.dval > (double) ACE_INT16_MAX
|| ev->u.dval < (double) ACE_INT16_MIN)
{
- return 0;
+ return 0;
}
ev->u.sval = (short) ev->u.dval;
@@ -1699,35 +1735,70 @@ incompatible_types (AST_Expression::ExprType t1,
// @@(JP) This just maps one enum to another. It's a temporary fix,
// but AST_Expression::EvalKind should go eventually.
static AST_Expression::AST_ExprValue *
-eval_kind(AST_Expression::AST_ExprValue *ev, AST_Expression::EvalKind ek)
+eval_kind (AST_Expression::AST_ExprValue *ev, AST_Expression::EvalKind ek)
{
+ // Make a copy to simplify the memory management logic.
+ AST_Expression::AST_ExprValue *newval = 0;
+ ACE_NEW_RETURN (newval,
+ AST_Expression::AST_ExprValue,
+ 0);
+
+ if (ev != 0)
+ {
+ *newval = *ev;
+ }
+
+ AST_Expression::AST_ExprValue *retval = 0;
+
switch (ek)
{
case AST_Expression::EK_const:
- return ev;
+ retval = newval;
+ break;
case AST_Expression::EK_positive_int:
- return coerce_value (ev, AST_Expression::EV_ulong);
+ retval = coerce_value (newval, AST_Expression::EV_ulong);
+ break;
case AST_Expression::EK_short:
- return coerce_value (ev, AST_Expression::EV_short);
+ retval = coerce_value (newval, AST_Expression::EV_short);
+ break;
case AST_Expression::EK_ushort:
- return coerce_value (ev, AST_Expression::EV_ushort);
+ retval = coerce_value (newval, AST_Expression::EV_ushort);
+ break;
case AST_Expression::EK_long:
- return coerce_value (ev, AST_Expression::EV_long);
+ retval = coerce_value (newval, AST_Expression::EV_long);
+ break;
case AST_Expression::EK_ulong:
- return coerce_value (ev, AST_Expression::EV_ulong);
+ retval = coerce_value (newval, AST_Expression::EV_ulong);
+ break;
#if ! defined (ACE_LACKS_LONGLONG_T)
case AST_Expression::EK_longlong:
- return coerce_value (ev, AST_Expression::EV_longlong);
+ retval = coerce_value (newval, AST_Expression::EV_longlong);
+ break;
case AST_Expression::EK_ulonglong:
- return coerce_value (ev, AST_Expression::EV_ulonglong);
+ retval = coerce_value (newval, AST_Expression::EV_ulonglong);
+ break;
#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
case AST_Expression::EK_octet:
- return coerce_value (ev, AST_Expression::EV_octet);
+ retval = coerce_value (newval, AST_Expression::EV_octet);
+ break;
case AST_Expression::EK_bool:
- return coerce_value (ev, AST_Expression::EV_bool);
+ retval = coerce_value (newval, AST_Expression::EV_bool);
+ break;
default:
- return 0;
+ break;
}
+
+ // Sometimes the call above to coerce_value() will return an
+ // evaluated newval, other times 0. But a heap-allocated
+ // ExprValue is not always passed to coerce_value(), so we
+ // have to manage it here, where we know it is always a 'new'.
+ if (retval != newval)
+ {
+ delete newval;
+ newval = 0;
+ }
+
+ return retval;
}
// Private operations.
@@ -2026,30 +2097,30 @@ AST_Expression::eval_bit_op (AST_Expression::EvalKind ek)
retval->et = EV_longlong;
switch (this->pd_ec)
- {
- case EC_or:
- retval->u.llval =
- this->pd_v1->ev ()->u.llval | this->pd_v2->ev ()->u.llval;
- break;
- case EC_xor:
- retval->u.llval =
- this->pd_v1->ev ()->u.llval ^ this->pd_v2->ev ()->u.llval;
- break;
- case EC_and:
- retval->u.llval =
- this->pd_v1->ev ()->u.llval & this->pd_v2->ev ()->u.llval;
- break;
- case EC_left:
- retval->u.llval =
- this->pd_v1->ev ()->u.llval << this->pd_v2->ev ()->u.llval;
- break;
- case EC_right:
- retval->u.llval =
- this->pd_v1->ev ()->u.llval >> this->pd_v2->ev ()->u.llval;
- break;
- default:
- return 0;
- }
+ {
+ case EC_or:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval | this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_xor:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval ^ this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_and:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval & this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_left:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval << this->pd_v2->ev ()->u.llval;
+ break;
+ case EC_right:
+ retval->u.llval =
+ this->pd_v1->ev ()->u.llval >> this->pd_v2->ev ()->u.llval;
+ break;
+ default:
+ return 0;
+ }
}
else
#endif
@@ -2393,45 +2464,52 @@ AST_Expression::check_and_coerce (AST_Expression::ExprType t,
AST_Expression::AST_ExprValue *
AST_Expression::coerce (AST_Expression::ExprType t)
{
+ AST_ExprValue *tmp = 0;
+
// First, evaluate it, then try to coerce result type.
// If already evaluated, return the result.
switch (t)
{
case EV_short:
- this->pd_ev = this->eval_internal (EK_short);
+ tmp = this->eval_internal (EK_short);
break;
case EV_ushort:
- this->pd_ev = this->eval_internal (EK_ushort);
+ tmp = this->eval_internal (EK_ushort);
break;
case EV_long:
- this->pd_ev = this->eval_internal (EK_long);
+ tmp = this->eval_internal (EK_long);
break;
case EV_ulong:
- this->pd_ev = this->eval_internal (EK_ulong);
+ tmp = this->eval_internal (EK_ulong);
break;
#if ! defined (ACE_LACKS_LONGLONG_T)
case EV_longlong:
- this->pd_ev = this->eval_internal (EK_longlong);
+ tmp = this->eval_internal (EK_longlong);
break;
case EV_ulonglong:
- this->pd_ev = this->eval_internal (EK_ulonglong);
+ tmp = this->eval_internal (EK_ulonglong);
break;
#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
case EV_octet:
- this->pd_ev = this->eval_internal (EK_octet);
+ tmp = this->eval_internal (EK_octet);
break;
case EV_bool:
- this->pd_ev = this->eval_internal (EK_bool);
+ tmp = this->eval_internal (EK_bool);
break;
default:
- this->pd_ev = this->eval_internal (EK_const);
+ tmp = this->eval_internal (EK_const);
break;
}
- if (pd_ev == 0)
+ if (tmp == 0)
{
return 0;
}
+ else
+ {
+ delete this->pd_ev;
+ this->pd_ev = tmp;
+ }
// Create a copy to contain coercion result.
AST_ExprValue *copy = 0;
@@ -2446,8 +2524,11 @@ AST_Expression::coerce (AST_Expression::ExprType t)
case EV_longdouble:
case EV_void:
case EV_none:
- case EV_enum:
+ delete copy;
return 0;
+ case EV_enum:
+ copy->u.ulval = this->pd_ev->u.ulval;
+ break;
case EV_short:
copy->u.sval = this->pd_ev->u.sval;
break;
@@ -2465,6 +2546,7 @@ AST_Expression::coerce (AST_Expression::ExprType t)
copy->u.llval = this->pd_ev->u.llval;
break;
#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ delete copy;
return 0;
#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
case EV_ulonglong:
@@ -2472,6 +2554,7 @@ AST_Expression::coerce (AST_Expression::ExprType t)
copy->u.ullval = this->pd_ev->u.ullval;
break;
#else /* ! defined (ACE_LACKS_LONGLONG_T) */
+ delete copy;
return 0;
#endif /* ! defined (ACE_LACKS_LONGLONG_T) */
case EV_bool:
@@ -2572,26 +2655,13 @@ AST_Expression::eval_internal (AST_Expression::EvalKind ek)
// Public operations.
-// Evaluate an AST_Expression, producing an AST_ExprValue or 0.
-AST_Expression::AST_ExprValue *
-AST_Expression::eval (AST_Expression::EvalKind ek)
-{
- // Call internal evaluator which does not coerce value to
- // EvalKind-expected format
- AST_Expression::AST_ExprValue *v = this->eval_internal (ek);
-
- // Then coerce according to EvalKind-expected format.
- return eval_kind (v,
- ek);
-}
-
// Evaluate "this", assigning the value to the pd_ev field.
void
AST_Expression::evaluate (EvalKind ek)
{
- this->pd_ev = this->eval_internal (ek);
- this->pd_ev = eval_kind (pd_ev,
- ek);
+ AST_ExprValue *tmp = eval_kind (this->pd_ev, ek);
+ delete this->pd_ev;
+ this->pd_ev = tmp;
}
// Expression equality comparison operator.
@@ -2988,8 +3058,39 @@ AST_Expression::ast_accept (ast_visitor *visitor)
void
AST_Expression::destroy (void)
{
-// delete this->pd_ev;
-// this->pd_ev = 0;
+ if (0 != this->pd_ev && EV_string == this->pd_ev->et)
+ {
+ this->pd_ev->u.strval->destroy ();
+ delete this->pd_ev->u.strval;
+ this->pd_ev->u.strval = 0;
+ }
+
+ delete this->pd_ev;
+ this->pd_ev = 0;
+
+ if (this->pd_v1 != 0)
+ {
+ this->pd_v1->destroy ();
+ }
+
+ if (this->pd_v2 != 0)
+ {
+ this->pd_v2->destroy ();
+ }
+
+ delete this->pd_v1;
+ this->pd_v1 = 0;
+
+ delete this->pd_v2;
+ this->pd_v2 = 0;
+
+ if (this->pd_n != 0)
+ {
+ this->pd_n->destroy ();
+ }
+
+ delete this->pd_n;
+ this->pd_n = 0;
}
// Data accessors.
@@ -3036,12 +3137,6 @@ AST_Expression::ec (void)
return this->pd_ec;
}
-void
-AST_Expression::set_ec (AST_Expression::ExprComb new_ec)
-{
- this->pd_ec = new_ec;
-}
-
AST_Expression::AST_ExprValue *
AST_Expression::ev (void)
{
@@ -3051,6 +3146,7 @@ AST_Expression::ev (void)
void
AST_Expression::set_ev (AST_Expression::AST_ExprValue *new_ev)
{
+ delete this->pd_ev;
this->pd_ev = new_ev;
}
diff --git a/TAO/TAO_IDL/ast/ast_factory.cpp b/TAO/TAO_IDL/ast/ast_factory.cpp
index f168d1d7738..9d240c3025e 100644
--- a/TAO/TAO_IDL/ast/ast_factory.cpp
+++ b/TAO/TAO_IDL/ast/ast_factory.cpp
@@ -145,6 +145,14 @@ AST_Factory::has_native (void)
void
AST_Factory::destroy (void)
{
+ if (0 != this->pd_exceptions)
+ {
+ this->pd_exceptions->destroy ();
+ this->pd_exceptions = 0;
+ }
+
+ this->AST_Decl::destroy ();
+ this->UTL_Scope::destroy ();
}
// Private operations.
@@ -292,6 +300,12 @@ AST_Factory::fe_add_exceptions (UTL_NameList *t)
this->pd_n_exceptions++;
}
+ // This return value is never used, it's easier to
+ // destroy it here and return 0 than to destroy it
+ // each place it is passed in.
+ t->destroy ();
+ delete t;
+ t = 0;
return t;
}
diff --git a/TAO/TAO_IDL/ast/ast_field.cpp b/TAO/TAO_IDL/ast/ast_field.cpp
index 93b450deb00..816fc654afc 100644
--- a/TAO/TAO_IDL/ast/ast_field.cpp
+++ b/TAO/TAO_IDL/ast/ast_field.cpp
@@ -85,7 +85,8 @@ AST_Field::AST_Field (void)
: COMMON_Base (),
AST_Decl (),
pd_field_type (0),
- pd_visibility (vis_NA)
+ pd_visibility (vis_NA),
+ anonymous_type_ (false)
{
}
@@ -97,8 +98,15 @@ AST_Field::AST_Field (AST_Type *ft,
AST_Decl (AST_Decl::NT_field,
n),
pd_field_type (ft),
- pd_visibility (vis)
+ pd_visibility (vis),
+ anonymous_type_ (false)
{
+ AST_Decl::NodeType fnt = ft->node_type ();
+
+ if (AST_Decl::NT_array == fnt || AST_Decl::NT_sequence == fnt)
+ {
+ this->anonymous_type_ = true;
+ }
}
// To be used when constructing a node of a subclass of AST_Field.
@@ -110,8 +118,15 @@ AST_Field::AST_Field (AST_Decl::NodeType nt,
AST_Decl (nt,
n),
pd_field_type (ft),
- pd_visibility (vis)
+ pd_visibility (vis),
+ anonymous_type_ (false)
{
+ AST_Decl::NodeType fnt = ft->node_type ();
+
+ if (AST_Decl::NT_array == fnt || AST_Decl::NT_sequence == fnt)
+ {
+ this->anonymous_type_ = true;
+ }
}
AST_Field::~AST_Field (void)
@@ -149,6 +164,19 @@ AST_Field::ast_accept (ast_visitor *visitor)
return visitor->visit_field (this);
}
+void
+AST_Field::destroy (void)
+{
+ if (this->anonymous_type_)
+ {
+ this->pd_field_type->destroy ();
+ delete this->pd_field_type;
+ this->pd_field_type = 0;
+ }
+
+ this->AST_Decl::destroy ();
+}
+
AST_Type *
AST_Field::field_type (void) const
{
diff --git a/TAO/TAO_IDL/ast/ast_generator.cpp b/TAO/TAO_IDL/ast/ast_generator.cpp
index d1ee63b8357..bcfe904b83e 100644
--- a/TAO/TAO_IDL/ast/ast_generator.cpp
+++ b/TAO/TAO_IDL/ast/ast_generator.cpp
@@ -202,8 +202,8 @@ AST_Generator::create_interface (UTL_ScopedName *n,
long n_inherits,
AST_Interface **inherits_flat,
long n_inherits_flat,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Interface *retval = 0;
ACE_NEW_RETURN (retval,
@@ -212,8 +212,8 @@ AST_Generator::create_interface (UTL_ScopedName *n,
n_inherits,
inherits_flat,
n_inherits_flat,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -221,21 +221,24 @@ AST_Generator::create_interface (UTL_ScopedName *n,
AST_InterfaceFwd *
AST_Generator::create_interface_fwd (UTL_ScopedName *n,
- bool local,
- bool abstract)
-{
+ bool is_local,
+ bool is_abstract)
+{
+ AST_Interface *full_defn = this->create_interface (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ is_local,
+ is_abstract);
+
AST_InterfaceFwd *retval = 0;
ACE_NEW_RETURN (retval,
- AST_InterfaceFwd (this->create_interface (n,
- 0,
- -1,
- 0,
- 0,
- local,
- abstract),
+ AST_InterfaceFwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -246,12 +249,12 @@ AST_Generator::create_valuetype (UTL_ScopedName *n,
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom)
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
{
AST_ValueType *retval = 0;
ACE_NEW_RETURN (retval,
@@ -261,12 +264,12 @@ AST_Generator::create_valuetype (UTL_ScopedName *n,
inherits_concrete,
inherits_flat,
n_inherits_flat,
- supports,
+ supports_list,
n_supports,
supports_concrete,
- abstract,
- truncatable,
- custom),
+ is_abstract,
+ is_truncatable,
+ is_custom),
0);
// The following helps with OBV_ namespace generation.
@@ -282,27 +285,28 @@ AST_Generator::create_valuetype (UTL_ScopedName *n,
AST_ValueTypeFwd *
AST_Generator::create_valuetype_fwd (UTL_ScopedName *n,
- bool abstract)
-{
- AST_ValueType *dummy = this->create_valuetype (n,
- 0,
- -1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- abstract,
- false,
- false);
+ bool is_abstract)
+{
+ AST_ValueType *full_defn = this->create_valuetype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
AST_ValueTypeFwd *retval = 0;
ACE_NEW_RETURN (retval,
- AST_ValueTypeFwd (dummy,
+ AST_ValueTypeFwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -313,12 +317,12 @@ AST_Generator::create_eventtype (UTL_ScopedName *n,
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom)
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
{
AST_EventType *retval = 0;
ACE_NEW_RETURN (retval,
@@ -328,12 +332,12 @@ AST_Generator::create_eventtype (UTL_ScopedName *n,
inherits_concrete,
inherits_flat,
n_inherits_flat,
- supports,
+ supports_list,
n_supports,
supports_concrete,
- abstract,
- truncatable,
- custom),
+ is_abstract,
+ is_truncatable,
+ is_custom),
0);
// The following helps with OBV_ namespace generation.
@@ -349,34 +353,35 @@ AST_Generator::create_eventtype (UTL_ScopedName *n,
AST_EventTypeFwd *
AST_Generator::create_eventtype_fwd (UTL_ScopedName *n,
- bool abstract)
-{
- AST_EventType *dummy = this->create_eventtype (n,
- 0,
- -1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- abstract,
- false,
- false);
+ bool is_abstract)
+{
+ AST_EventType *full_defn = this->create_eventtype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
AST_EventTypeFwd *retval = 0;
ACE_NEW_RETURN (retval,
- AST_EventTypeFwd (dummy,
+ AST_EventTypeFwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
AST_Component *
AST_Generator::create_component (UTL_ScopedName *n,
AST_Component *base_component,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat)
@@ -385,7 +390,7 @@ AST_Generator::create_component (UTL_ScopedName *n,
ACE_NEW_RETURN (retval,
AST_Component (n,
base_component,
- supports,
+ supports_list,
n_supports,
supports_flat,
n_supports_flat),
@@ -397,19 +402,20 @@ AST_Generator::create_component (UTL_ScopedName *n,
AST_ComponentFwd *
AST_Generator::create_component_fwd (UTL_ScopedName *n)
{
- AST_Component *dummy = this->create_component (n,
- 0,
- 0,
- -1,
- 0,
- 0);
+ AST_Component *full_defn = this->create_component (n,
+ 0,
+ 0,
+ -1,
+ 0,
+ 0);
AST_ComponentFwd *retval = 0;
ACE_NEW_RETURN (retval,
- AST_ComponentFwd (dummy,
+ AST_ComponentFwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -418,7 +424,7 @@ AST_Generator::create_home (UTL_ScopedName *n,
AST_Home *base_home,
AST_Component *managed_component,
AST_ValueType *primary_key,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat)
@@ -429,7 +435,7 @@ AST_Generator::create_home (UTL_ScopedName *n,
base_home,
managed_component,
primary_key,
- supports,
+ supports_list,
n_supports,
supports_flat,
n_supports_flat),
@@ -440,14 +446,14 @@ AST_Generator::create_home (UTL_ScopedName *n,
AST_Exception *
AST_Generator::create_exception (UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Exception *retval = 0;
ACE_NEW_RETURN (retval,
AST_Exception (n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -455,14 +461,14 @@ AST_Generator::create_exception (UTL_ScopedName *n,
AST_Structure *
AST_Generator::create_structure (UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Structure *retval = 0;
ACE_NEW_RETURN (retval,
AST_Structure (n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -471,28 +477,29 @@ AST_Generator::create_structure (UTL_ScopedName *n,
AST_StructureFwd *
AST_Generator::create_structure_fwd (UTL_ScopedName *n)
{
- AST_Structure *dummy = this->create_structure (n,
- 0,
- 0);
+ AST_Structure *full_defn = this->create_structure (n,
+ false,
+ false);
AST_StructureFwd *retval = 0;
ACE_NEW_RETURN (retval,
- AST_StructureFwd (dummy,
+ AST_StructureFwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
AST_Enum *
AST_Generator::create_enum (UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Enum *retval = 0;
ACE_NEW_RETURN (retval,
AST_Enum (n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -502,16 +509,16 @@ AST_Operation *
AST_Generator::create_operation (AST_Type *rt,
AST_Operation::Flags fl,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Operation *retval = 0;
ACE_NEW_RETURN (retval,
AST_Operation (rt,
fl,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -551,16 +558,16 @@ AST_Attribute *
AST_Generator::create_attribute (bool ro,
AST_Type *ft,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Attribute *retval = 0;
ACE_NEW_RETURN (retval,
AST_Attribute (ro,
ft,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -569,15 +576,15 @@ AST_Generator::create_attribute (bool ro,
AST_Union *
AST_Generator::create_union (AST_ConcreteType *dt,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Union *retval = 0;
ACE_NEW_RETURN (retval,
AST_Union (dt,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -586,16 +593,17 @@ AST_Generator::create_union (AST_ConcreteType *dt,
AST_UnionFwd *
AST_Generator::create_union_fwd (UTL_ScopedName *n)
{
- AST_Union *dummy = this->create_union (0,
- n,
- 0,
- 0);
+ AST_Union *full_defn = this->create_union (0,
+ n,
+ false,
+ false);
AST_UnionFwd *retval = 0;
ACE_NEW_RETURN (retval,
- AST_UnionFwd (dummy,
+ AST_UnionFwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -788,16 +796,16 @@ AST_Array *
AST_Generator::create_array (UTL_ScopedName *n,
unsigned long ndims,
UTL_ExprList *dims,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Array *retval = 0;
ACE_NEW_RETURN (retval,
AST_Array (n,
ndims,
dims,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -807,16 +815,16 @@ AST_Sequence *
AST_Generator::create_sequence (AST_Expression *ms,
AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Sequence *retval = 0;
ACE_NEW_RETURN (retval,
AST_Sequence (ms,
bt,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -865,15 +873,15 @@ AST_Generator::create_wstring (AST_Expression *ms)
AST_Typedef *
AST_Generator::create_typedef (AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
AST_Typedef *retval = 0;
ACE_NEW_RETURN (retval,
AST_Typedef (bt,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
diff --git a/TAO/TAO_IDL/ast/ast_home.cpp b/TAO/TAO_IDL/ast/ast_home.cpp
index 1b927cbcbdf..fa65bd3e1a0 100644
--- a/TAO/TAO_IDL/ast/ast_home.cpp
+++ b/TAO/TAO_IDL/ast/ast_home.cpp
@@ -162,6 +162,44 @@ AST_Home::finders (void)
void
AST_Home::destroy (void)
{
+ // We have to go through these conniptions to destroy
+ // a home because its decls (for which there are no
+ // copy constructors) are assigned to the scope
+ // of the equivalent interface, which will destroy
+ // them. But we still have to destroy the containers
+ // for those references, which may be private or
+ // protected.
+
+ delete [] this->inherits ();
+ delete [] this->inherits_flat ();
+
+ delete [] this->pd_decls;
+ this->pd_decls = 0;
+ this->pd_decls_allocated = 0;
+ this->pd_decls_used = 0;
+
+ delete [] this->pd_referenced;
+ this->pd_referenced = 0;
+ this->pd_referenced_allocated = 0;
+ this->pd_referenced_used = 0;
+
+ // These are stored by copying the Identifier.
+ for (long i = 0; i < this->pd_name_referenced_used; ++i)
+ {
+ this->pd_name_referenced[i]->destroy ();
+ delete this->pd_name_referenced[i];
+ this->pd_name_referenced[i] = 0;
+ }
+
+ delete [] this->pd_name_referenced;
+ this->pd_name_referenced = 0;
+ this->pd_name_referenced_allocated = 0;
+ this->pd_name_referenced_used = 0;
+
+ // Skip AST_Interface, since the home's decls
+ // are added to the equivalent interface, and
+ // they should get destroyed there.
+ this->AST_Type::destroy ();
}
void
diff --git a/TAO/TAO_IDL/ast/ast_interface.cpp b/TAO/TAO_IDL/ast/ast_interface.cpp
index b6fa8f38f18..64bb76d9e96 100644
--- a/TAO/TAO_IDL/ast/ast_interface.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface.cpp
@@ -110,7 +110,8 @@ AST_Interface::AST_Interface (void)
pd_n_inherits (0),
pd_inherits_flat (0),
pd_n_inherits_flat (0),
- home_equiv_ (false)
+ home_equiv_ (false),
+ fwd_decl_ (0)
{
this->size_type (AST_Type::VARIABLE); // Always the case.
this->has_constructor (true); // Always the case.
@@ -134,7 +135,8 @@ AST_Interface::AST_Interface (UTL_ScopedName *n,
pd_n_inherits (nih),
pd_inherits_flat (ih_flat),
pd_n_inherits_flat (nih_flat),
- home_equiv_ (false)
+ home_equiv_ (false),
+ fwd_decl_ (0)
{
this->size_type (AST_Type::VARIABLE); // always the case
this->has_constructor (true); // always the case
@@ -161,6 +163,21 @@ AST_Interface::be_add_operation (AST_Operation *op)
return this->fe_add_operation (op);
}
+bool
+AST_Interface::is_defined (void)
+{
+ // Each instance of a forward declared interface no
+ // longer has a redefined full definition, so we
+ // have to backtrack to the fwd decl is_defined(),
+ // which searches for the one that does. If one
+ // is found, then we are defined for code generation
+ // purposes. See AST_InterfaceFwd::destroy() to
+ // see the difference for cleanup purposes.
+ return (0 == this->fwd_decl_
+ ? this->pd_n_inherits >= 0
+ : this->fwd_decl_->is_defined ());
+}
+
// Add an AST_Constant node (a constant declaration) to this scope.
AST_Constant *
AST_Interface::fe_add_constant (AST_Constant *t)
@@ -1096,7 +1113,11 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
scope = parent->defined_in ();
}
- // Full definition must have the same prefix as the forward declaration.
+ // (JP) This could give a bogus error, since typeprefix can
+ // appear any time after the corresponding declaration.
+ // The right way to do this is with a separate traversal
+ // after the entire AST is built.
+ /*
if (ACE_OS::strcmp (i->prefix (), d->prefix ()) != 0)
{
idl_global->err ()->error1 (UTL_Error::EIDL_PREFIX_CONFLICT,
@@ -1104,30 +1125,9 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
return;
}
+ */
- AST_Decl::NodeType nt = d->node_type ();
-
- // If this interface has been forward declared in a previous opening
- // of the module it's defined in, the lookup will find the
- // forward declaration.
- if (nt == AST_Decl::NT_interface_fwd
- || nt == AST_Decl::NT_valuetype_fwd
- || nt == AST_Decl::NT_component_fwd
- || nt == AST_Decl::NT_eventtype_fwd)
- {
- AST_InterfaceFwd *fwd_def =
- AST_InterfaceFwd::narrow_from_decl (d);
-
- fd = fwd_def->full_definition ();
- }
- // In all other cases, the lookup will find an interface node.
- else if (nt == AST_Decl::NT_interface
- || nt == AST_Decl::NT_valuetype
- || nt == AST_Decl::NT_component
- || nt == AST_Decl::NT_eventtype)
- {
- fd = AST_Interface::narrow_from_decl (d);
- }
+ fd = AST_Interface::narrow_from_decl (d);
// Successful?
if (fd == 0)
@@ -1169,6 +1169,7 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
fd->redefine (i);
// Use full definition node.
+ i->destroy ();
delete i;
i = fd;
}
@@ -1231,6 +1232,18 @@ AST_Interface::home_equiv (bool val)
this->home_equiv_ = val;
}
+AST_InterfaceFwd *
+AST_Interface::fwd_decl (void) const
+{
+ return this->fwd_decl_;
+}
+
+void
+AST_Interface::fwd_decl (AST_InterfaceFwd *node)
+{
+ this->fwd_decl_ = node;
+}
+
int
AST_Interface::insert_non_dup (AST_Interface *t,
bool abstract_paths_only)
@@ -1316,13 +1329,32 @@ AST_Interface::redefine (AST_Interface *from)
// definition, which may be in a different scope.
// Since 'this' will replace 'from' upon returning
// from here, we have to update the scope now.
- this->pd_inherits = from->pd_inherits;
this->pd_n_inherits = from->pd_n_inherits;
- this->pd_inherits_flat = from->pd_inherits_flat;
+ unsigned long i = 0;
+
+ unsigned long array_size =
+ static_cast<unsigned long> (from->pd_n_inherits);
+ ACE_NEW (this->pd_inherits,
+ AST_Interface *[array_size]);
+
+ for (i = 0; i < array_size; ++i)
+ {
+ this->pd_inherits[i] = from->pd_inherits[i];
+ }
+
this->pd_n_inherits_flat = from->pd_n_inherits_flat;
+ array_size =
+ static_cast<unsigned long> (from->pd_n_inherits_flat);
+ ACE_NEW (this->pd_inherits_flat,
+ AST_Interface *[array_size]);
+
+ for (i = 0; i < array_size; ++i)
+ {
+ this->pd_inherits_flat[i] = from->pd_inherits_flat[i];
+ }
// 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 ());
@@ -1508,8 +1540,6 @@ AST_Interface::look_in_inherited (UTL_ScopedName *e,
// Can't look in an interface which was not yet defined.
if (!this->is_defined ())
{
- idl_global->err ()->fwd_decl_lookup (this,
- e);
return 0;
}
@@ -1630,8 +1660,14 @@ AST_Interface::destroy (void)
{
delete [] this->pd_inherits;
this->pd_inherits = 0;
+ this->pd_n_inherits = 0;
+
delete [] this->pd_inherits_flat;
this->pd_inherits_flat = 0;
+ this->pd_n_inherits_flat = 0;
+
+ this->UTL_Scope::destroy ();
+ this->AST_Type::destroy ();
}
int
diff --git a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
index ad57956a211..7d9c2e78a1b 100644
--- a/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface_fwd.cpp
@@ -71,6 +71,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_interface_fwd.h"
#include "ast_interface.h"
+#include "ast_module.h"
#include "ast_visitor.h"
#include "utl_identifier.h"
@@ -82,7 +83,8 @@ AST_InterfaceFwd::AST_InterfaceFwd (void)
: COMMON_Base (),
AST_Decl (),
AST_Type (),
- pd_full_definition (0)
+ pd_full_definition (0),
+ is_defined_ (false)
{
}
@@ -93,7 +95,8 @@ AST_InterfaceFwd::AST_InterfaceFwd (AST_Interface *dummy,
AST_Decl (AST_Decl::NT_interface_fwd,
n),
AST_Type (AST_Decl::NT_interface_fwd,
- n)
+ n),
+ is_defined_ (false)
{
// Create a dummy placeholder for the forward declared interface. This
// interface node is not yet defined (n_inherits < 0), so some operations
@@ -125,6 +128,50 @@ AST_InterfaceFwd::is_abstract_valuetype (void)
&& this->is_valuetype ());
}
+bool
+AST_InterfaceFwd::full_def_seen (void)
+{
+ UTL_Scope *s = this->defined_in ();
+ AST_Interface *i = 0;
+
+ // If a full definition is seen in a previous module opening
+ // or anywhere in the current scope (before or after our
+ // declaration, reture TRUE.
+
+ if (AST_Decl::NT_module == s->scope_node_type ())
+ {
+ AST_Module *m = AST_Module::narrow_from_scope (s);
+ AST_Decl *d = m->look_in_previous (this->local_name (), false);
+
+ if (0 != d)
+ {
+ i = AST_Interface::narrow_from_decl (d);
+
+ if (0 != i && i->is_defined ())
+ {
+ return true;
+ }
+ }
+ }
+
+ for (UTL_ScopeActiveIterator iter (s, UTL_Scope::IK_decls);
+ !iter.is_done ();
+ iter.next ())
+ {
+ i = AST_Interface::narrow_from_decl (iter.item ());
+
+ if (0 != i && this->local_name ()->compare (i->local_name ()))
+ {
+ if (i->is_defined ())
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
// Redefinition of inherited virtual operations.
// Dump this AST_InterfaceFwd node to the ostream o.
@@ -170,15 +217,75 @@ AST_InterfaceFwd::set_full_definition (AST_Interface *nfd)
bool
AST_InterfaceFwd::is_defined (void)
{
- return this->pd_full_definition->is_defined ();
+ // Look for the one instance of the fwd decl
+ // that may have a full definition.
+ if (!this->is_defined_)
+ {
+ AST_Module *m =
+ AST_Module::narrow_from_scope (this->defined_in ());
+
+ if (0 != m)
+ {
+ AST_Decl *d = m->look_in_previous (this->local_name ());
+
+ if (0 != d)
+ {
+ // We could be looking at a superfluous forward decl
+ // of an interface already defined.
+ AST_Interface *full = AST_Interface::narrow_from_decl (d);
+
+ if (0 != full)
+ {
+ this->is_defined_ = true;
+ }
+
+ AST_InterfaceFwd *fwd =
+ AST_InterfaceFwd::narrow_from_decl (d);
+
+ // Since fwd_redefinition_helper() is called
+ // before fe_add_interface(), we can't check
+ // n_inherits() or is_defined(), but added()
+ // is a sufficient way to tell if our full
+ // definition has already gone through the
+ // add_to_scope process.
+ if (0 != fwd && fwd->full_definition ()->added ())
+ {
+ this->is_defined_ = true;
+ }
+ }
+ }
+ }
+
+ return this->is_defined_;
+}
+
+void
+AST_InterfaceFwd::set_as_defined (void)
+{
+ this->is_defined_ = true;
}
void
AST_InterfaceFwd::destroy (void)
{
-// this->pd_full_definition->destroy ();
-// delete this->pd_full_definition;
-// this->pd_full_definition = 0;
+ // The implementation of is_defined() accomodates
+ // code generation issues and doesn't have the
+ // correct semantics here. The older implementation
+ // of is_defined is used in the IF block below to
+ // check if our full definition allocation must be
+ // destroyed.
+ if (!this->is_defined_)
+ {
+ // If our full definition is not defined, it
+ // means that there was no full definition
+ // for us in this compilation unit, so we
+ // have to destroy this allocation.
+ this->pd_full_definition->destroy ();
+ delete this->pd_full_definition;
+ this->pd_full_definition = 0;
+ }
+
+ this->AST_Type::destroy ();
}
// Narrowing methods.
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp
index f3c43f66947..4bb08eddfb8 100644
--- a/TAO/TAO_IDL/ast/ast_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -230,6 +230,11 @@ AST_Module::fe_add_module (AST_Module *t)
{
d->prefix (const_cast<char *> (this_prefix));
}
+ // (JP) This could give a bogus error, since typeprefix can
+ // appear any time after the corresponding declaration.
+ // The right way to do this is with a separate traversal
+ // after the entire AST is built.
+ /*
else
{
if (ACE_OS::strcmp (this_prefix, prev_prefix) != 0)
@@ -241,6 +246,7 @@ AST_Module::fe_add_module (AST_Module *t)
return 0;
}
}
+ */
}
}
@@ -340,6 +346,17 @@ AST_Module::fe_add_interface (AST_Interface *t)
// Add it to scope
this->add_to_scope (t);
+ // We do this for interfaces, valuetypes and components in
+ // a different place than we do for structs and unions,
+ // since fwd declared structs and unions must be defined in
+ // the same translation unit.
+ AST_InterfaceFwd *fd = t->fwd_decl ();
+
+ if (0 != fd)
+ {
+ fd->set_as_defined ();
+ }
+
// Add it to set of locally referenced symbols
this->add_to_referenced (t,
false,
@@ -475,6 +492,17 @@ AST_Module::fe_add_valuetype (AST_ValueType *t)
// Add it to scope
this->add_to_scope (t);
+ // We do this for interfaces, valuetypes and components in
+ // a different place than we do for structs and unions,
+ // since fwd declared structs and unions must be defined in
+ // the same translation unit.
+ AST_InterfaceFwd *fd = t->fwd_decl ();
+
+ if (0 != fd)
+ {
+ fd->set_as_defined ();
+ }
+
// Add it to set of locally referenced symbols
this->add_to_referenced (t,
false,
@@ -648,6 +676,17 @@ AST_Module::fe_add_component (AST_Component *t)
// Add it to scope
this->add_to_scope (t);
+
+ // We do this for interfaces, valuetypes and components in
+ // a different place than we do for structs and unions,
+ // since fwd declared structs and unions must be defined in
+ // the same translation unit.
+ AST_InterfaceFwd *fd = t->fwd_decl ();
+
+ if (0 != fd)
+ {
+ fd->set_as_defined ();
+ }
// Add it to set of locally referenced symbols
this->add_to_referenced (t,
@@ -712,13 +751,13 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i)
if ((d = this->lookup_for_add (i, false)) != 0)
{
AST_Decl::NodeType nt = d->node_type ();
-
+/*
if (nt == AST_Decl::NT_interface_fwd)
{
AST_InterfaceFwd *ifwd = AST_InterfaceFwd::narrow_from_decl (d);
i->set_full_definition (ifwd->full_definition ());
}
-
+*/
// There used to be another check here ANDed with the one below:
// d->defined_in () == this. But lookup_for_add calls only
// lookup_by_name_local(), which does not bump up the scope,
@@ -741,7 +780,7 @@ AST_Module::fe_add_interface_fwd (AST_InterfaceFwd *i)
}
// @@ Redefinition of forward. Type check not implemented.
- i->set_full_definition (itf); // @@ Memory leak.
+// i->set_full_definition (itf); // @@ Memory leak.
return i;
}
@@ -1031,9 +1070,9 @@ AST_Module::fe_add_constant (AST_Constant *t)
if (!can_be_redefined (d))
{
idl_global->err ()->error3 (UTL_Error::EIDL_REDEF,
- t,
- this,
- d);
+ t,
+ this,
+ d);
return 0;
}
@@ -1695,7 +1734,15 @@ AST_Module::referenced (AST_Decl *e,
return true;
}
- return this->look_in_previous (e->local_name (), true) != 0;
+ AST_Decl *d = this->look_in_previous (e->local_name (), true);
+
+ if (0 == d)
+ {
+ return false;
+ }
+
+ AST_Type *t = AST_Type::narrow_from_decl (d);
+ return 0 == t || t->is_defined ();
}
void
@@ -1797,6 +1844,7 @@ AST_Module::previous (void)
void
AST_Module::destroy (void)
{
+ this->UTL_Scope::destroy ();
this->AST_Decl::destroy ();
}
diff --git a/TAO/TAO_IDL/ast/ast_native.cpp b/TAO/TAO_IDL/ast/ast_native.cpp
index baf2ff321be..c8f5b6625c1 100644
--- a/TAO/TAO_IDL/ast/ast_native.cpp
+++ b/TAO/TAO_IDL/ast/ast_native.cpp
@@ -41,6 +41,12 @@ AST_Native::~AST_Native (void)
{
}
+void
+AST_Native::destroy (void)
+{
+ this->AST_Exception::destroy ();
+}
+
// Dump this AST_Native node to the ostream o.
void
AST_Native::dump (ACE_OSTREAM_TYPE &o)
diff --git a/TAO/TAO_IDL/ast/ast_operation.cpp b/TAO/TAO_IDL/ast/ast_operation.cpp
index fd4abf11824..4efe7f6a6a6 100644
--- a/TAO/TAO_IDL/ast/ast_operation.cpp
+++ b/TAO/TAO_IDL/ast/ast_operation.cpp
@@ -210,6 +210,19 @@ AST_Operation::has_native (void)
void
AST_Operation::destroy (void)
{
+ // No need to delete our exception list, the
+ // destroy() method does it. The UTL_ExceptList
+ // destroy() method does NOT delete the contained
+ // exception nodes.
+
+ if (this->pd_exceptions != 0)
+ {
+ this->pd_exceptions->destroy ();
+ this->pd_exceptions = 0;
+ }
+
+ this->UTL_Scope::destroy ();
+ this->AST_Decl::destroy ();
}
// Private operations.
@@ -323,6 +336,11 @@ AST_Operation::be_insert_exception (AST_Exception *ex)
UTL_NameList *
AST_Operation::fe_add_exceptions (UTL_NameList *t)
{
+ if (0 == t)
+ {
+ return 0;
+ }
+
UTL_ScopedName *nl_n = 0;
AST_Exception *fe = 0;
AST_Decl *d = 0;
@@ -375,7 +393,13 @@ AST_Operation::fe_add_exceptions (UTL_NameList *t)
}
}
- return t;
+ // This return value is never used, it's easier to
+ // destroy it here and return 0 than to destroy it
+ // each place it is passed in.
+ t->destroy ();
+ delete t;
+ t = 0;
+ return 0;
}
// Add this AST_Argument node (an operation argument declaration)
diff --git a/TAO/TAO_IDL/ast/ast_predefined_type.cpp b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
index 0f45b9b9a34..e98a2486abf 100644
--- a/TAO/TAO_IDL/ast/ast_predefined_type.cpp
+++ b/TAO/TAO_IDL/ast/ast_predefined_type.cpp
@@ -270,7 +270,7 @@ AST_PredefinedType::ast_accept (ast_visitor *visitor)
void
AST_PredefinedType::destroy (void)
{
- this->AST_Type::destroy ();
+ this->AST_ConcreteType::destroy ();
}
// Data accessors.
diff --git a/TAO/TAO_IDL/ast/ast_root.cpp b/TAO/TAO_IDL/ast/ast_root.cpp
index 5daf5e67380..5c87e1983e9 100644
--- a/TAO/TAO_IDL/ast/ast_root.cpp
+++ b/TAO/TAO_IDL/ast/ast_root.cpp
@@ -78,23 +78,23 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ace/OS_NS_string.h"
#include "ace/OS_Memory.h"
-ACE_RCSID (ast,
- ast_root,
+ACE_RCSID (ast,
+ ast_root,
"$Id$")
AST_Root::AST_Root (void)
- : COMMON_Base (),
+ : COMMON_Base (),
AST_Decl (),
- UTL_Scope (),
+ UTL_Scope (),
AST_Module ()
{
}
AST_Root::AST_Root (UTL_ScopedName *n)
- : COMMON_Base (),
+ : COMMON_Base (),
AST_Decl (AST_Decl::NT_root,
n),
- UTL_Scope (AST_Decl::NT_root),
+ UTL_Scope (AST_Decl::NT_root),
AST_Module (n)
{
}
@@ -118,10 +118,10 @@ AST_Root::nmembers (void)
{
continue;
}
-
+
++retval;
}
-
+
return retval;
}
@@ -221,21 +221,18 @@ AST_Root::destroy ()
long i = 0;
long j = 0;
AST_Decl *d = 0;
-
+
// Just destroy and delete the non-predefined types in the
// scope, in case we are processing multiple IDL files.
// Final cleanup will be done in fini().
for (i = this->pd_decls_used; i > 0; --i)
{
d = this->pd_decls[i - 1];
-
+
// We want to keep the predefined types we add to global
// scope around and not add them each time.
if (d->node_type () == AST_Decl::NT_pre_defined)
{
- // This needs to be j = i, but it has been temporarily
- // changed for the CoSMIC release. Need to actually
- // track down the source of the problem with tao_picml.
j = i;
break;
}
@@ -245,18 +242,21 @@ AST_Root::destroy ()
d = 0;
--this->pd_decls_used;
}
-
+
+ // This array of pointers holds references, no need
+ // for destruction. The array itself will be cleaned
+ // up when AST_Root::fini() calls UTL_Scope::destroy ().
for (i = this->pd_referenced_used; i > j; --i)
{
- d = this->pd_referenced[i - 1];
- d = 0;
+ this->pd_referenced[i - 1] = 0;
--this->pd_referenced_used;
}
-
+
for (i = this->pd_name_referenced_used; i > j; --i)
{
Identifier *id = this->pd_name_referenced[i - 1];
id->destroy ();
+ delete id;
id = 0;
--this->pd_name_referenced_used;
}
@@ -265,27 +265,6 @@ AST_Root::destroy ()
void
AST_Root::fini (void)
{
- long i = 0;
-
- for (i = this->pd_referenced_used; i > 0; --i)
- {
- AST_Decl *d = this->pd_referenced[i - 1];
-
- if (d->node_type () == AST_Decl::NT_pre_defined)
- {
- break;
- }
-
- d = 0;
- }
-
- for (i = this->pd_name_referenced_used; i > 0; --i)
- {
- Identifier *id = this->pd_name_referenced[i - 1];
- id->destroy ();
- id = 0;
- }
-
this->UTL_Scope::destroy ();
this->AST_Decl::destroy ();
}
diff --git a/TAO/TAO_IDL/ast/ast_sequence.cpp b/TAO/TAO_IDL/ast/ast_sequence.cpp
index f580f1ab215..6389a8b6f0a 100644
--- a/TAO/TAO_IDL/ast/ast_sequence.cpp
+++ b/TAO/TAO_IDL/ast/ast_sequence.cpp
@@ -90,7 +90,8 @@ AST_Sequence::AST_Sequence (void)
AST_Type (),
AST_ConcreteType (),
pd_max_size (0),
- pd_base_type (0)
+ pd_base_type (0),
+ owns_base_type_ (false)
{
// A sequence data type is always VARIABLE.
this->size_type (AST_Type::VARIABLE);
@@ -111,7 +112,8 @@ AST_Sequence::AST_Sequence (AST_Expression *ms,
AST_ConcreteType (AST_Decl::NT_sequence,
n),
pd_max_size (ms),
- pd_base_type (bt)
+ pd_base_type (bt),
+ owns_base_type_ (false)
{
// Check if we are bounded or unbounded. An expression value of 0 means
// unbounded.
@@ -126,6 +128,13 @@ AST_Sequence::AST_Sequence (AST_Expression *ms,
// A sequence data type is always VARIABLE.
this->size_type (AST_Type::VARIABLE);
+
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (AST_Decl::NT_array == nt || AST_Decl::NT_sequence == nt)
+ {
+ this->owns_base_type_ = true;
+ }
}
AST_Sequence::~AST_Sequence (void)
@@ -167,27 +176,25 @@ AST_Sequence::in_recursion (ACE_Unbounded_Queue<AST_Type *> &list)
}
}
- if (this->match_names (this, list))
+ if (this->match_names (type, list))
{
// They match.
this->in_recursion_ = 1;
idl_global->recursive_type_seen_ = true;
- return this->in_recursion_;
}
else
{
// Check the element type.
- ACE_Unbounded_Queue<AST_Type *> scope_list = list;
- scope_list.enqueue_tail (this);
- this->in_recursion_ = type->in_recursion (scope_list);
+ list.enqueue_tail (type);
+ this->in_recursion_ = type->in_recursion (list);
if (this->in_recursion_ == 1)
{
idl_global->recursive_type_seen_ = true;
}
-
- return this->in_recursion_;
}
+
+ return this->in_recursion_;
}
// Redefinition of inherited virtual operations.
@@ -235,6 +242,23 @@ AST_Sequence::legal_for_primary_key (void) const
return this->base_type ()->legal_for_primary_key ();
}
+void
+AST_Sequence::destroy (void)
+{
+ if (this->owns_base_type_)
+ {
+ this->pd_base_type->destroy ();
+ delete this->pd_base_type;
+ this->pd_base_type = 0;
+ }
+
+ this->pd_max_size->destroy ();
+ delete this->pd_max_size;
+ this->pd_max_size = 0;
+
+ this->AST_ConcreteType::destroy ();
+}
+
// Narrowing.
IMPL_NARROW_METHODS1(AST_Sequence, AST_ConcreteType)
IMPL_NARROW_FROM_DECL(AST_Sequence)
diff --git a/TAO/TAO_IDL/ast/ast_string.cpp b/TAO/TAO_IDL/ast/ast_string.cpp
index cb24793fa37..35fed0da5a1 100644
--- a/TAO/TAO_IDL/ast/ast_string.cpp
+++ b/TAO/TAO_IDL/ast/ast_string.cpp
@@ -186,7 +186,7 @@ AST_String::destroy (void)
delete this->pd_max_size;
this->pd_max_size = 0;
- this->AST_Decl::destroy ();
+ this->AST_ConcreteType::destroy ();
}
// Data accessors.
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.
diff --git a/TAO/TAO_IDL/ast/ast_structure_fwd.cpp b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
index 9faabb96eb7..f6b87046559 100644
--- a/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
+++ b/TAO/TAO_IDL/ast/ast_structure_fwd.cpp
@@ -18,18 +18,20 @@ AST_StructureFwd::AST_StructureFwd (void)
: COMMON_Base (),
AST_Decl (),
AST_Type (),
- pd_full_definition (0)
+ pd_full_definition (0),
+ is_defined_ (false)
{
}
-AST_StructureFwd::AST_StructureFwd (AST_Structure *dummy,
+AST_StructureFwd::AST_StructureFwd (AST_Structure *full_defn,
UTL_ScopedName *n)
: COMMON_Base (),
AST_Decl (AST_Decl::NT_struct_fwd,
n),
AST_Type (AST_Decl::NT_struct_fwd,
n),
- pd_full_definition (dummy)
+ pd_full_definition (full_defn),
+ is_defined_ (false)
{
}
@@ -72,12 +74,26 @@ AST_StructureFwd::set_full_definition (AST_Structure *nfd)
bool
AST_StructureFwd::is_defined (void)
{
- return (this->pd_full_definition != 0);
+ return this->is_defined_;
+}
+
+void
+AST_StructureFwd::set_as_defined (void)
+{
+ this->is_defined_ = true;
}
void
AST_StructureFwd::destroy (void)
{
+ if (!this->is_defined_ && 0 != this->pd_full_definition)
+ {
+ this->pd_full_definition->destroy ();
+ delete this->pd_full_definition;
+ this->pd_full_definition = 0;
+ }
+
+ this->AST_Type::destroy ();
}
// Narrowing methods.
diff --git a/TAO/TAO_IDL/ast/ast_type.cpp b/TAO/TAO_IDL/ast/ast_type.cpp
index 7719f80bb5c..58624791838 100644
--- a/TAO/TAO_IDL/ast/ast_type.cpp
+++ b/TAO/TAO_IDL/ast/ast_type.cpp
@@ -554,6 +554,9 @@ AST_Type::ast_accept (ast_visitor *visitor)
void
AST_Type::destroy (void)
{
+ delete [] this->nested_type_name_;
+ this->nested_type_name_ = 0;
+
this->AST_Decl::destroy ();
}
diff --git a/TAO/TAO_IDL/ast/ast_typedef.cpp b/TAO/TAO_IDL/ast/ast_typedef.cpp
index e96bdcc802c..1a841472ffe 100644
--- a/TAO/TAO_IDL/ast/ast_typedef.cpp
+++ b/TAO/TAO_IDL/ast/ast_typedef.cpp
@@ -84,7 +84,8 @@ AST_Typedef::AST_Typedef (void)
: COMMON_Base (),
AST_Decl (),
AST_Type (),
- pd_base_type (0)
+ pd_base_type (0),
+ owns_base_type_ (false)
{
}
@@ -98,8 +99,15 @@ AST_Typedef::AST_Typedef (AST_Type *bt,
n),
AST_Type (AST_Decl::NT_typedef,
n),
- pd_base_type (bt)
+ pd_base_type (bt),
+ owns_base_type_ (false)
{
+ AST_Decl::NodeType nt = bt->node_type ();
+
+ if (AST_Decl::NT_array == nt || AST_Decl::NT_sequence == nt)
+ {
+ this->owns_base_type_ = true;
+ }
}
AST_Typedef::~AST_Typedef (void)
@@ -188,6 +196,14 @@ AST_Typedef::ast_accept (ast_visitor *visitor)
void
AST_Typedef::destroy (void)
{
+ if (this->owns_base_type_)
+ {
+ this->pd_base_type->destroy ();
+ delete this->pd_base_type;
+ this->pd_base_type = 0;
+ }
+
+ this->AST_Type::destroy ();
}
// Data accessors.
diff --git a/TAO/TAO_IDL/ast/ast_union_branch.cpp b/TAO/TAO_IDL/ast/ast_union_branch.cpp
index 9f1809d397d..8fff20afb86 100644
--- a/TAO/TAO_IDL/ast/ast_union_branch.cpp
+++ b/TAO/TAO_IDL/ast/ast_union_branch.cpp
@@ -127,6 +127,16 @@ AST_UnionBranch::ast_accept (ast_visitor *visitor)
return visitor->visit_union_branch (this);
}
+void
+AST_UnionBranch::destroy (void)
+{
+ this->pd_ll->destroy ();
+ delete this->pd_ll;
+ this->pd_ll = 0;
+
+ this->AST_Field::destroy ();
+}
+
// Data accessors.
AST_UnionLabel *
diff --git a/TAO/TAO_IDL/ast/ast_union_label.cpp b/TAO/TAO_IDL/ast/ast_union_label.cpp
index d64dbca3571..37a2e337020 100644
--- a/TAO/TAO_IDL/ast/ast_union_label.cpp
+++ b/TAO/TAO_IDL/ast/ast_union_label.cpp
@@ -89,7 +89,7 @@ AST_UnionLabel::AST_UnionLabel (void)
AST_UnionLabel::AST_UnionLabel (UnionLabel lk,
AST_Expression *lv)
: pd_label_kind (lk),
- pd_label_val (lv)
+ pd_label_val (lv)
{
if (lv != 0)
{
@@ -123,6 +123,18 @@ AST_UnionLabel::ast_accept (ast_visitor *visitor)
return visitor->visit_union_label (this);
}
+void
+AST_UnionLabel::destroy (void)
+{
+ // Otherwise (default label) our label value is 0.
+ if (UL_label == this->pd_label_kind)
+ {
+ this->pd_label_val->destroy ();
+ delete this->pd_label_val;
+ this->pd_label_val = 0;
+ }
+}
+
// Data accessors.
AST_UnionLabel::UnionLabel
diff --git a/TAO/TAO_IDL/ast/ast_valuebox.cpp b/TAO/TAO_IDL/ast/ast_valuebox.cpp
index ebe7e2a2be1..0b687de22dc 100644
--- a/TAO/TAO_IDL/ast/ast_valuebox.cpp
+++ b/TAO/TAO_IDL/ast/ast_valuebox.cpp
@@ -55,6 +55,12 @@ AST_ValueBox::ast_accept (ast_visitor *visitor)
return visitor->visit_valuebox (this);
}
+void
+AST_ValueBox::destroy (void)
+{
+ this->AST_ConcreteType::destroy ();
+}
+
// Narrowing.
IMPL_NARROW_METHODS1(AST_ValueBox, AST_ConcreteType)
IMPL_NARROW_FROM_DECL(AST_ValueBox)
diff --git a/TAO/TAO_IDL/ast/ast_valuetype.cpp b/TAO/TAO_IDL/ast/ast_valuetype.cpp
index d4ecbddf35b..459525d98b3 100644
--- a/TAO/TAO_IDL/ast/ast_valuetype.cpp
+++ b/TAO/TAO_IDL/ast/ast_valuetype.cpp
@@ -148,8 +148,8 @@ AST_ValueType::look_in_supported (UTL_ScopedName *e,
// Can't look in an interface which was not yet defined.
if (!this->is_defined ())
{
- idl_global->err ()->fwd_decl_lookup (this,
- e);
+// idl_global->err ()->fwd_decl_lookup (this,
+// e);
return 0;
}
@@ -268,6 +268,10 @@ AST_ValueType::legal_for_primary_key (void) const
void
AST_ValueType::destroy (void)
{
+ delete [] this->pd_supports;
+ this->pd_supports = 0;
+ this->pd_n_supports = 0;
+
this->AST_Interface::destroy ();
}
diff --git a/TAO/TAO_IDL/be/be_argument.cpp b/TAO/TAO_IDL/be/be_argument.cpp
index e5cbeadc83a..c2c0774a91d 100644
--- a/TAO/TAO_IDL/be/be_argument.cpp
+++ b/TAO/TAO_IDL/be/be_argument.cpp
@@ -79,6 +79,13 @@ be_argument::accept (be_visitor *visitor)
return visitor->visit_argument (this);
}
+void
+be_argument::destroy (void)
+{
+ this->be_decl::destroy ();
+ this->AST_Argument::destroy ();
+}
+
// Narrowing.
IMPL_NARROW_METHODS2 (be_argument, AST_Argument, be_decl)
IMPL_NARROW_FROM_DECL (be_argument)
diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp
index 3c13a4589b2..72042f19118 100644
--- a/TAO/TAO_IDL/be/be_array.cpp
+++ b/TAO/TAO_IDL/be/be_array.cpp
@@ -184,23 +184,13 @@ be_array::compute_tc_name (void)
ACE_NEW (tao_id,
Identifier ("TAO"));
-// ACE_NEW (tao_id,
-// Identifier (""));
-
ACE_NEW (this->tc_name_,
UTL_ScopedName (tao_id,
0));
-// char bound[30] = { 0 };
-
-// ACE_OS::sprintf (bound,
-// "_%lu",
-// this->max_size ()->ev ()->u.ulval);
-
ACE_CString local_tc_name =
ACE_CString ("tc_")
+ ACE_CString (this->flat_name ());
-// + ACE_CString (bound);
Identifier * typecode_scope = 0;
ACE_NEW (typecode_scope,
@@ -273,6 +263,13 @@ be_array::accept (be_visitor *visitor)
return visitor->visit_array (this);
}
+void
+be_array::destroy (void)
+{
+ this->be_type::destroy ();
+ this->AST_Array::destroy ();
+}
+
// Narrowing
IMPL_NARROW_METHODS2 (be_array, AST_Array, be_type)
IMPL_NARROW_FROM_DECL (be_array)
diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp
index ad9b0daf940..ad32663ab16 100644
--- a/TAO/TAO_IDL/be/be_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_attribute.cpp
@@ -138,6 +138,27 @@ be_attribute::get_get_strategy ()
return this->get_strategy_;
}
+void
+be_attribute::destroy (void)
+{
+ if (0 != this->get_strategy_)
+ {
+ this->get_strategy_->destroy ();
+ delete this->get_strategy_;
+ this->get_strategy_ = 0;
+ }
+
+ if (0 != this->set_strategy_)
+ {
+ this->set_strategy_->destroy ();
+ delete this->set_strategy_;
+ this->set_strategy_ = 0;
+ }
+
+ this->be_decl::destroy ();
+ this->AST_Attribute::destroy ();
+}
+
// Narrowing
IMPL_NARROW_METHODS2 (be_attribute, AST_Attribute, be_decl)
IMPL_NARROW_FROM_DECL (be_attribute)
diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp
index f7d56338d4f..1729d5c571a 100644
--- a/TAO/TAO_IDL/be/be_codegen.cpp
+++ b/TAO/TAO_IDL/be/be_codegen.cpp
@@ -56,25 +56,6 @@ TAO_CodeGen::TAO_CodeGen (void)
// destructor
TAO_CodeGen::~TAO_CodeGen (void)
{
- delete this->client_header_;
- delete this->server_header_;
- delete this->implementation_header_;
- delete this->implementation_skeleton_;
- delete this->server_template_header_;
- delete this->client_stubs_;
- delete this->server_skeletons_;
- delete this->server_template_skeletons_;
- delete this->client_inline_;
- delete this->server_inline_;
- delete this->server_template_inline_;
- delete this->anyop_source_;
-#if !defined (linux) && !defined (__QNX__) && !defined(__GLIBC__)
- // This causes a seg fault on Linux RH 5.1. Let it leak . . .
- delete this->gperf_input_stream_;
-#endif /* ! linux */
- delete [] this->gperf_input_filename_;
- this->curr_os_ = 0;
- // delete this->visitor_factory_;
}
// visitor factory method
@@ -124,7 +105,7 @@ TAO_CodeGen::upcase (const char *str)
int
TAO_CodeGen::start_client_header (const char *fname)
{
- if (fname == 0)
+ if (0 == fname)
{
// Bad file name.
return -1;
@@ -137,7 +118,8 @@ TAO_CodeGen::start_client_header (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->client_header_;
this->client_header_ = factory->make_outstream ();
if (!this->client_header_)
@@ -220,6 +202,8 @@ TAO_CodeGen::start_client_header (const char *fname)
const char* client_hdr =
BE_GlobalData::be_get_client_hdr (&idl_name_str,
1);
+
+ idl_name_str.destroy ();
// Sanity check and then print.
if (client_hdr != 0)
@@ -265,7 +249,8 @@ TAO_CodeGen::start_client_stubs (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->client_stubs_;
this->client_stubs_ = factory->make_outstream ();
if (!this->client_stubs_)
@@ -320,7 +305,8 @@ TAO_CodeGen::start_client_inline (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->client_inline_;
this->client_inline_ = factory->make_outstream ();
if (!this->client_inline_)
@@ -357,7 +343,8 @@ TAO_CodeGen::start_server_header (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->server_header_;
this->server_header_ = factory->make_outstream ();
if (!this->server_header_)
@@ -423,6 +410,8 @@ TAO_CodeGen::start_server_header (const char *fname)
const char* server_hdr =
BE_GlobalData::be_get_server_hdr (&idl_name_str, 1);
+
+ idl_name_str.destroy ();
this->server_header_->print ("\n#include \"%s\"",
server_hdr);
@@ -499,7 +488,8 @@ TAO_CodeGen::start_server_template_header (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->server_template_header_;
this->server_template_header_ = factory->make_outstream ();
if (!this->server_template_header_)
@@ -557,7 +547,8 @@ TAO_CodeGen::start_server_skeletons (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->server_skeletons_;
this->server_skeletons_ = factory->make_outstream ();
if (!this->server_skeletons_)
@@ -635,7 +626,8 @@ TAO_CodeGen::start_server_template_skeletons (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->server_template_skeletons_;
this->server_template_skeletons_ = factory->make_outstream ();
if (!this->server_template_skeletons_)
@@ -701,7 +693,8 @@ TAO_CodeGen::start_server_inline (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->server_inline_;
this->server_inline_ = factory->make_outstream ();
if (!this->server_inline_)
@@ -738,7 +731,8 @@ TAO_CodeGen::start_server_template_inline (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->server_template_inline_;
this->server_template_inline_ = factory->make_outstream ();
if (!this->server_template_inline_)
@@ -774,25 +768,38 @@ TAO_CodeGen::server_template_inline (void)
int
TAO_CodeGen::start_anyop_header (const char *fname)
{
+ if (!be_global->gen_anyop_files ())
+ {
+ return 0;
+ }
+
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->anyop_header_;
this->anyop_header_ = factory->make_outstream ();
- if (!this->anyop_header_)
+ if (0 == this->anyop_header_)
{
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_header - "
+ "Error creating file stream\n"),
+ -1);
}
if (this->anyop_header_->open (fname,
TAO_OutStream::TAO_CLI_HDR)
== -1)
{
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_header - "
+ "Error opening file\n"),
+ -1);
}
- *this->anyop_header_ << be_nl << "// TAO_IDL - Generated from" << be_nl
+ *this->anyop_header_ << be_nl
+ << "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__
<< be_nl << be_nl;
@@ -858,6 +865,8 @@ TAO_CodeGen::start_anyop_header (const char *fname)
const char *anyop_hdr =
BE_GlobalData::be_get_anyop_header (&idl_name_str, 1);
+
+ idl_name_str.destroy ();
ACE_CString pidl_checker (idl_name);
bool got_pidl =
@@ -919,22 +928,34 @@ TAO_CodeGen::start_anyop_header (const char *fname)
int
TAO_CodeGen::start_anyop_source (const char *fname)
{
+ if (!be_global->gen_anyop_files ())
+ {
+ return 0;
+ }
+
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->anyop_source_;
this->anyop_source_ = factory->make_outstream ();
- if (!this->anyop_source_)
+ if (0 == this->anyop_source_)
{
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_source - "
+ "Error creating file stream\n"),
+ -1);
}
if (this->anyop_source_->open (fname,
TAO_OutStream::TAO_CLI_IMPL)
== -1)
{
- return -1;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "TAO_CodeGen::start_anyop_source - "
+ "Error opening file\n"),
+ -1);
}
// Generate the include statement for the precompiled header file.
@@ -980,7 +1001,8 @@ TAO_CodeGen::start_implementation_header (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->implementation_header_;
this->implementation_header_ = factory->make_outstream ();
if (!this->implementation_header_)
@@ -1042,7 +1064,8 @@ TAO_CodeGen::start_implementation_skeleton (const char *fname)
// Retrieve the singleton instance to the outstream factory.
TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();
- // Retrieve a specialized instance.
+ // Clean up between multiple files.
+ delete this->implementation_skeleton_;
this->implementation_skeleton_ = factory->make_outstream ();
if (!this->implementation_skeleton_)
@@ -1677,6 +1700,8 @@ TAO_CodeGen::gen_stub_hdr_includes (void)
const char *anyop_hdr =
BE_GlobalData::be_get_anyop_header (&idl_name_str, 1);
+
+ idl_name_str.destroy ();
// Stripped off any scope in the name and add the
// AnyTypeCode prefix.
@@ -2328,3 +2353,27 @@ TAO_CodeGen::gen_typecode_includes (TAO_OutStream * stream)
"tao/AnyTypeCode/Recursive_Type_TypeCode.h",
stream);
}
+
+void
+TAO_CodeGen::destroy (void)
+{
+ delete this->client_header_;
+ delete this->server_header_;
+ delete this->implementation_header_;
+ delete this->implementation_skeleton_;
+ delete this->server_template_header_;
+ delete this->client_stubs_;
+ delete this->server_skeletons_;
+ delete this->server_template_skeletons_;
+ delete this->client_inline_;
+ delete this->server_inline_;
+ delete this->server_template_inline_;
+ delete this->anyop_source_;
+ delete this->anyop_header_;
+#if !defined (linux) && !defined (__QNX__) && !defined (__GLIBC__)
+ // This causes a seg fault on Linux RH 5.1. Let it leak . . .
+ delete this->gperf_input_stream_;
+#endif /* ! linux */
+ delete [] this->gperf_input_filename_;
+ this->curr_os_ = 0;
+}
diff --git a/TAO/TAO_IDL/be/be_constant.cpp b/TAO/TAO_IDL/be/be_constant.cpp
index 8661b192a82..be495979757 100644
--- a/TAO/TAO_IDL/be/be_constant.cpp
+++ b/TAO/TAO_IDL/be/be_constant.cpp
@@ -59,8 +59,8 @@ be_constant::accept (be_visitor *visitor)
void
be_constant::destroy (void)
{
- this->AST_Constant::destroy ();
this->be_decl::destroy ();
+ this->AST_Constant::destroy ();
}
// Narrowing
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index a492b119e8d..a1e8c1eedf1 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -278,13 +278,12 @@ be_decl::compute_flat_name (const char *prefix,
result_str += suffix_str;
}
- name = ACE_OS::strdup (result_str.rep ());
+ name = ACE_OS::strdup (result_str.c_str ());
}
void
be_decl::destroy (void)
{
- this->AST_Decl::destroy ();
}
void
diff --git a/TAO/TAO_IDL/be/be_enum.cpp b/TAO/TAO_IDL/be/be_enum.cpp
index 35256b01780..4b5ccad4b10 100644
--- a/TAO/TAO_IDL/be/be_enum.cpp
+++ b/TAO/TAO_IDL/be/be_enum.cpp
@@ -75,6 +75,8 @@ be_enum::destroy (void)
// No need to call be_scope::destroy(). It has no
// allocated members, and AST_Enum::destroy() will
// call UTL_Scope::destroy().
+ this->be_type::destroy ();
+ this->be_scope::destroy ();
this->AST_Enum::destroy ();
}
diff --git a/TAO/TAO_IDL/be/be_exception.cpp b/TAO/TAO_IDL/be/be_exception.cpp
index 9982658aa41..3f8711549bc 100644
--- a/TAO/TAO_IDL/be/be_exception.cpp
+++ b/TAO/TAO_IDL/be/be_exception.cpp
@@ -79,8 +79,9 @@ void
be_exception::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_type::destroy ();
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Exception::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_factory.cpp b/TAO/TAO_IDL/be/be_factory.cpp
index ff0ffc44a78..271648d6f6b 100644
--- a/TAO/TAO_IDL/be/be_factory.cpp
+++ b/TAO/TAO_IDL/be/be_factory.cpp
@@ -57,8 +57,10 @@ void
be_factory::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_decl::destroy ();
+ this->be_scope::destroy ();
+ this->be_decl::destroy ();
+
+ this->AST_Factory::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_field.cpp b/TAO/TAO_IDL/be/be_field.cpp
index 567c8799ab2..d33847bed01 100644
--- a/TAO/TAO_IDL/be/be_field.cpp
+++ b/TAO/TAO_IDL/be/be_field.cpp
@@ -66,6 +66,13 @@ be_field::accept (be_visitor *visitor)
return visitor->visit_field (this);
}
+void
+be_field::destroy (void)
+{
+ this->be_decl::destroy ();
+ this->AST_Field::destroy ();
+}
+
// Narrowing
IMPL_NARROW_METHODS2 (be_field, AST_Field, be_decl)
IMPL_NARROW_FROM_DECL (be_field)
diff --git a/TAO/TAO_IDL/be/be_generator.cpp b/TAO/TAO_IDL/be/be_generator.cpp
index da42383c03c..49dfc20a7ce 100644
--- a/TAO/TAO_IDL/be/be_generator.cpp
+++ b/TAO/TAO_IDL/be/be_generator.cpp
@@ -225,31 +225,24 @@ be_generator::create_interface (UTL_ScopedName *n,
AST_InterfaceFwd *
be_generator::create_interface_fwd (UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
- AST_Decl *d =
- idl_global->scopes ().top_non_null ()->lookup_by_name (n, true);
-
- AST_Interface *dummy = this->create_interface (n,
- 0,
- -1,
- 0,
- 0,
- local,
- abstract);
+ AST_Interface *full_defn = this->create_interface (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ is_local,
+ is_abstract);
be_interface_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_interface_fwd (dummy,
+ be_interface_fwd (full_defn,
n),
0);
- if (d != 0)
- {
- retval->prefix (const_cast<char *> (ScopeAsDecl (d->defined_in ())->prefix ()));
- }
-
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -273,12 +266,12 @@ be_generator::create_valuetype (UTL_ScopedName *n,
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom)
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
{
be_valuetype *retval = 0;
ACE_NEW_RETURN (retval,
@@ -288,12 +281,12 @@ be_generator::create_valuetype (UTL_ScopedName *n,
inherits_concrete,
inherits_flat,
n_inherits_flat,
- supports,
+ supports_list,
n_supports,
supports_concrete,
- abstract,
- truncatable,
- custom),
+ is_abstract,
+ is_truncatable,
+ is_custom),
0);
return retval;
@@ -301,27 +294,28 @@ be_generator::create_valuetype (UTL_ScopedName *n,
AST_ValueTypeFwd *
be_generator::create_valuetype_fwd (UTL_ScopedName *n,
- bool abstract)
-{
- AST_ValueType *dummy = this->create_valuetype (n,
- 0,
- -1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- abstract,
- 0,
- 0);
+ bool is_abstract)
+{
+ AST_ValueType *full_defn = this->create_valuetype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
be_valuetype_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_valuetype_fwd (dummy,
+ be_valuetype_fwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -332,12 +326,12 @@ be_generator::create_eventtype (UTL_ScopedName *n,
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom)
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom)
{
be_eventtype *retval = 0;
ACE_NEW_RETURN (retval,
@@ -347,12 +341,12 @@ be_generator::create_eventtype (UTL_ScopedName *n,
inherits_concrete,
inherits_flat,
n_inherits_flat,
- supports,
+ supports_list,
n_supports,
supports_concrete,
- abstract,
- truncatable,
- custom),
+ is_abstract,
+ is_truncatable,
+ is_custom),
0);
return retval;
@@ -360,34 +354,35 @@ be_generator::create_eventtype (UTL_ScopedName *n,
AST_EventTypeFwd *
be_generator::create_eventtype_fwd (UTL_ScopedName *n,
- bool abstract)
-{
- AST_EventType *dummy = this->create_eventtype (n,
- 0,
- -1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- abstract,
- 0,
- 0);
+ bool is_abstract)
+{
+ AST_EventType *full_defn = this->create_eventtype (n,
+ 0,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ is_abstract,
+ false,
+ false);
be_eventtype_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_eventtype_fwd (dummy,
+ be_eventtype_fwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
AST_Component *
be_generator::create_component (UTL_ScopedName *n,
AST_Component *base_component,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat)
@@ -396,7 +391,7 @@ be_generator::create_component (UTL_ScopedName *n,
ACE_NEW_RETURN (retval,
be_component (n,
base_component,
- supports,
+ supports_list,
n_supports,
supports_flat,
n_supports_flat),
@@ -408,19 +403,20 @@ be_generator::create_component (UTL_ScopedName *n,
AST_ComponentFwd *
be_generator::create_component_fwd (UTL_ScopedName *n)
{
- AST_Component *dummy = this->create_component (n,
- 0,
- 0,
- -1,
- 0,
- 0);
+ AST_Component *full_defn = this->create_component (n,
+ 0,
+ 0,
+ -1,
+ 0,
+ 0);
be_component_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_component_fwd (dummy,
+ be_component_fwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -429,7 +425,7 @@ be_generator::create_home (UTL_ScopedName *n,
AST_Home *base_home,
AST_Component *managed_component,
AST_ValueType *primary_key,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat)
@@ -440,7 +436,7 @@ be_generator::create_home (UTL_ScopedName *n,
base_home,
managed_component,
primary_key,
- supports,
+ supports_list,
n_supports,
supports_flat,
n_supports_flat),
@@ -451,14 +447,14 @@ be_generator::create_home (UTL_ScopedName *n,
AST_Exception *
be_generator::create_exception (UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_exception *retval = 0;
ACE_NEW_RETURN (retval,
be_exception (n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -466,14 +462,14 @@ be_generator::create_exception (UTL_ScopedName *n,
AST_Structure *
be_generator::create_structure (UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_structure *retval = 0;
ACE_NEW_RETURN (retval,
be_structure (n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -483,28 +479,29 @@ AST_StructureFwd *
be_generator::create_structure_fwd (UTL_ScopedName *n)
{
- AST_Structure *dummy = this->create_structure (n,
- 0,
- 0);
+ AST_Structure *full_defn = this->create_structure (n,
+ false,
+ false);
be_structure_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_structure_fwd (dummy,
+ be_structure_fwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
AST_Enum *
be_generator::create_enum (UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_enum *retval = 0;
ACE_NEW_RETURN (retval,
be_enum (n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -514,16 +511,16 @@ AST_Operation *
be_generator::create_operation (AST_Type *rt,
AST_Operation::Flags fl,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_operation *retval = 0;
ACE_NEW_RETURN (retval,
be_operation (rt,
fl,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -563,16 +560,16 @@ AST_Attribute *
be_generator::create_attribute (bool ro,
AST_Type *ft,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_attribute *retval = 0;
ACE_NEW_RETURN (retval,
be_attribute (ro,
ft,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -581,15 +578,15 @@ be_generator::create_attribute (bool ro,
AST_Union *
be_generator::create_union (AST_ConcreteType *dt,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_union *retval = 0;
ACE_NEW_RETURN (retval,
be_union (dt,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -598,16 +595,17 @@ be_generator::create_union (AST_ConcreteType *dt,
AST_UnionFwd *
be_generator::create_union_fwd (UTL_ScopedName *n)
{
- AST_Union *dummy = this->create_union (0,
- n,
- 0,
- 0);
+ AST_Union *full_defn = this->create_union (0,
+ n,
+ false,
+ false);
be_union_fwd *retval = 0;
ACE_NEW_RETURN (retval,
- be_union_fwd (dummy,
+ be_union_fwd (full_defn,
n),
0);
+ full_defn->fwd_decl (retval);
return retval;
}
@@ -800,16 +798,16 @@ AST_Array *
be_generator::create_array (UTL_ScopedName *n,
unsigned long ndims,
UTL_ExprList *dims,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_array *retval = 0;
ACE_NEW_RETURN (retval,
be_array (n,
ndims,
dims,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -819,16 +817,16 @@ AST_Sequence *
be_generator::create_sequence (AST_Expression *v,
AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_sequence *retval = 0;
ACE_NEW_RETURN (retval,
be_sequence (v,
bt,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
@@ -878,15 +876,15 @@ be_generator::create_wstring (AST_Expression *v)
AST_Typedef *
be_generator::create_typedef (AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract)
+ bool is_local,
+ bool is_abstract)
{
be_typedef *retval = 0;
ACE_NEW_RETURN (retval,
be_typedef (bt,
n,
- local,
- abstract),
+ is_local,
+ is_abstract),
0);
return retval;
diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp
index 41e7ae0fbce..31c9aee32a7 100644
--- a/TAO/TAO_IDL/be/be_global.cpp
+++ b/TAO/TAO_IDL/be/be_global.cpp
@@ -20,6 +20,11 @@
#include "be_global.h"
#include "be_codegen.h"
#include "be_generator.h"
+#include "be_module.h"
+#include "be_valuetype.h"
+#include "be_interface.h"
+#include "ast_predefined_type.h"
+#include "utl_identifier.h"
#include "utl_string.h"
#include "global_extern.h"
#include "idl_defines.h"
@@ -91,11 +96,15 @@ BE_GlobalData::BE_GlobalData (void)
lookup_strategy_ (TAO_PERFECT_HASH),
void_type_ (0),
ccmobject_ (0),
+ messaging_ (0),
+ messaging_exceptionholder_ (0),
exceptionholder_ (0),
+ messaging_replyhandler_ (0),
gen_anyop_files_ (false),
gen_skel_files_ (true),
gen_client_inline_ (true),
- gen_server_inline_ (true)
+ gen_server_inline_ (true),
+ gen_local_iface_anyops_ (true)
{
}
@@ -1127,30 +1136,182 @@ BE_GlobalData::destroy (void)
delete [] this->anyop_output_dir_;
this->anyop_output_dir_ = 0;
+
+ if (0 != this->messaging_)
+ {
+ this->messaging_->destroy ();
+ delete this->messaging_;
+ this->messaging_ = 0;
+ }
+
+ if (0 != this->messaging_exceptionholder_)
+ {
+ this->messaging_exceptionholder_->destroy ();
+ delete this->messaging_exceptionholder_;
+ this->messaging_exceptionholder_ = 0;
+ }
+
+ if (0 != this->messaging_replyhandler_)
+ {
+ this->messaging_replyhandler_->destroy ();
+ delete this->messaging_replyhandler_;
+ this->messaging_replyhandler_ = 0;
+ }
+
+ if (0 != tao_cg)
+ {
+ tao_cg->destroy ();
+ }
}
AST_PredefinedType *
-BE_GlobalData:: void_type (void) const
+BE_GlobalData:: void_type (void)
{
+ if (0 == this->void_type_)
+ {
+ AST_Decl *d =
+ idl_global->scopes ().bottom ()->lookup_primitive_type (
+ AST_Expression::EV_void
+ );
+ this->void_type_ = AST_PredefinedType::narrow_from_decl (d);
+ }
+
return this->void_type_;
}
-void
-BE_GlobalData::void_type (AST_PredefinedType *val)
+be_interface *
+BE_GlobalData::ccmobject (void)
{
- this->void_type_ = val;
+ if (0 == this->ccmobject_)
+ {
+ Identifier *local_id = 0;
+ ACE_NEW_RETURN (local_id,
+ Identifier ("CCMObject"),
+ 0);
+ UTL_ScopedName *local_name = 0;
+ ACE_NEW_RETURN (local_name,
+ UTL_ScopedName (local_id, 0),
+ 0);
+
+ Identifier *module_id = 0;
+ ACE_NEW_RETURN (module_id,
+ Identifier ("Components"),
+ 0);
+ UTL_ScopedName sn (module_id,
+ local_name);
+
+ AST_Decl *d =
+ idl_global->scopes ().top_non_null ()->lookup_by_name (&sn,
+ true);
+
+ sn.destroy ();
+
+ if (0 == d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_global::ccmobject - "
+ "lookup of CCMObject failed\n"),
+ 0);
+ }
+
+ this->ccmobject_ = be_interface::narrow_from_decl (d);
+ }
+
+ return this->ccmobject_;
}
-be_interface *
-BE_GlobalData::ccmobject (void) const
+be_module *
+BE_GlobalData::messaging (void)
{
- return this->ccmobject_;
+ if (0 == this->messaging_)
+ {
+ Identifier *id = 0;
+ UTL_ScopedName *sn = 0;
+
+ ACE_NEW_RETURN (id,
+ Identifier ("Messaging"),
+ 0);
+
+ ACE_NEW_RETURN (sn,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ ACE_NEW_RETURN (this->messaging_,
+ be_module (sn),
+ 0);
+
+ this->messaging_->set_name (sn);
+ }
+
+ return this->messaging_;
}
-void
-BE_GlobalData::ccmobject (be_interface *val)
+be_valuetype *
+BE_GlobalData::messaging_exceptionholder (void)
{
- this->ccmobject_ = val;
+ if (0 == this->messaging_exceptionholder_)
+ {
+ Identifier *id = 0;
+ be_module *msg = this->messaging ();
+ idl_global->scopes ().push (msg);
+
+ ACE_NEW_RETURN (id,
+ Identifier ("Messaging"),
+ 0);
+
+ // Create a valuetype "ExceptionHolder"
+ // from which we inherit.
+ UTL_ScopedName *full_name = 0;
+ ACE_NEW_RETURN (full_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ ACE_NEW_RETURN (id,
+ Identifier ("ExceptionHolder"),
+ 0);
+
+ UTL_ScopedName *local_name = 0;
+ ACE_NEW_RETURN (local_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ full_name->nconc (local_name);
+
+ ACE_NEW_RETURN (this->messaging_exceptionholder_,
+ be_valuetype (full_name,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0),
+ 0);
+
+ this->messaging_exceptionholder_->set_name (full_name);
+
+ // Notice the valuetype "ExceptionHolder" that it is defined in the
+ // "Messaging" module
+ this->messaging_exceptionholder_->set_defined_in (msg);
+ this->messaging_exceptionholder_->set_prefix_with_typeprefix (
+ "omg.org"
+ );
+
+ idl_global->scopes ().pop ();
+
+ // Notice the interface "ReplyHandler" that it is defined in the
+ // "Messaging" module.
+ this->messaging_exceptionholder_->set_defined_in (msg);
+ }
+
+ return this->messaging_exceptionholder_;
}
be_valuetype *
@@ -1165,6 +1326,64 @@ BE_GlobalData::exceptionholder (be_valuetype *val)
this->exceptionholder_ = val;
}
+be_interface *
+BE_GlobalData::messaging_replyhandler (void)
+{
+ if (0 == this->messaging_replyhandler_)
+ {
+ be_module *msg = this->messaging ();
+ idl_global->scopes ().push (msg);
+
+ Identifier *id = 0;
+ UTL_ScopedName *local_name = 0;
+
+ // Create a virtual module named "Messaging"
+ // "and an interface "ReplyHandler"
+ // from which we inherit.
+ ACE_NEW_RETURN (id,
+ Identifier ("Messaging"),
+ 0);
+
+ UTL_ScopedName *full_name = 0;
+ ACE_NEW_RETURN (full_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ ACE_NEW_RETURN (id,
+ Identifier ("ReplyHandler"),
+ 0);
+
+ ACE_NEW_RETURN (local_name,
+ UTL_ScopedName (id,
+ 0),
+ 0);
+
+ full_name->nconc (local_name);
+
+ ACE_NEW_RETURN (this->messaging_replyhandler_,
+ be_interface (full_name,
+ 0, // inherited interfaces
+ 0, // number of inherited interfaces
+ 0, // ancestors
+ 0, // number of ancestors
+ 0, // not local
+ 0), // not abstract
+ 0);
+
+ this->messaging_replyhandler_->set_name (full_name);
+ this->messaging_replyhandler_->set_prefix_with_typeprefix ("omg.org");
+
+ idl_global->scopes ().pop ();
+
+ // Notice the interface "ReplyHandler" that it is defined in the
+ // "Messaging" module.
+ this->messaging_replyhandler_->set_defined_in (msg);
+ }
+
+ return this->messaging_replyhandler_;
+}
+
bool
BE_GlobalData::gen_anyop_files (void) const
{
@@ -1213,6 +1432,18 @@ BE_GlobalData::gen_server_inline (bool val)
this->gen_server_inline_ = val;
}
+bool
+BE_GlobalData::gen_local_iface_anyops (void) const
+{
+ return this->gen_local_iface_anyops_;
+}
+
+void
+BE_GlobalData::gen_local_iface_anyops (bool val)
+{
+ this->gen_local_iface_anyops_ = val;
+}
+
ACE_CString
BE_GlobalData::spawn_options (void)
{
@@ -1242,40 +1473,39 @@ BE_GlobalData::parse_args (long &i, char **av)
// @@ No error handling done here.
idl_global->append_idl_flag (av[i + 1]);
be_global->client_hdr_ending (av[i + 1]);
- i++;
+ ++i;
}
else if (av[i][2] == 's')
{
// Server skeleton's header file.
idl_global->append_idl_flag (av[i + 1]);
be_global->server_hdr_ending (av[i + 1]);
- i++;
+ ++i;
}
else if (av[i][2] == 'T')
{
- // Server Template header ending.
+ // Server template header ending.
idl_global->append_idl_flag (av[i + 1]);
be_global->server_template_hdr_ending (av[i + 1]);
- i++;
- }
+ ++i;
+ }
else if (av[i][2] == 'I')
{
- // Server Template header ending.
+ // Server implementation header ending.
idl_global->append_idl_flag (av[i + 1]);
be_global->implementation_hdr_ending (av[i + 1]);
- i++;
+ ++i;
}
else
{
- // I expect 'c' or 's' or 'T' after this.
+ // I expect 'c' or 's' or 'I' or 'T' after this.
ACE_ERROR ((
LM_ERROR,
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
// = Various 'c'lient side stub file_name_endings.
case 'c':
@@ -1290,14 +1520,12 @@ BE_GlobalData::parse_args (long &i, char **av)
be_global->client_stub_ending (av[i + 1]);
i++;
}
-
else if (av[i][2] == 'i')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->client_inline_ending (av[i + 1]);
i++;
}
-
else
{
// I expect 's' or 'i' after 'c'.
@@ -1306,9 +1534,8 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
// = Various 's'erver side skeleton file name endings.
case 's':
@@ -1327,34 +1554,32 @@ BE_GlobalData::parse_args (long &i, char **av)
{
idl_global->append_idl_flag (av[i + 1]);
be_global->server_skeleton_ending (av[i + 1]);
- i++;
+ ++i;
}
else if (av[i][2] == 'T')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->server_template_skeleton_ending (av[i + 1]);
- i++;
+ ++i;
}
else if (av[i][2] == 'i')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->server_inline_ending (av[i + 1]);
- i++;
+ ++i;
}
else if (av[i][2] == 't')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->server_template_inline_ending (av[i + 1]);
- i++;
+ ++i;
}
-
else if (av[i][2] == 'I')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->implementation_skel_ending (av[i + 1]);
- i++;
+ ++i;
}
-
else
{
// I expect 's' or 'T' or 'i' or 't' after 's'.
@@ -1363,22 +1588,19 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
-
// Operation lookup strategy.
// <perfect_hash>, <dynamic_hash> or <binary_search>
// Default is perfect.
case 'H':
idl_global->append_idl_flag (av[i + 1]);
- if (av[i+1] == 0 || av[i+1][0] == '-')
+ if (av[i + 1] == 0 || av[i + 1][0] == '-')
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("no selection for -H option\n")));
- ACE_OS::exit (99);
}
else if (ACE_OS::strcmp (av[i+1], "dynamic_hash") == 0)
{
@@ -1410,10 +1632,9 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("%s: unknown operation lookup <%s>\n"),
av[0],
av[i + 1]));
- ACE_OS::exit (99);
}
- i++;
+ ++i;
break;
// Switching between ""s and <>s when we generate
// #include statements for the standard files (e.g. tao/corba.h)
@@ -1433,9 +1654,8 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
// Path for the perfect hash generator(gperf) program. Default
// is $ACE_ROOT/bin/gperf.
@@ -1452,7 +1672,7 @@ BE_GlobalData::parse_args (long &i, char **av)
tmp += "\\gperf.exe";
#endif
idl_global->gperf_path (tmp.fast_rep ());
- i++;
+ ++i;
}
else
{
@@ -1462,9 +1682,8 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT (" the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
// Directory where all the IDL-Compiler-Generated files are to
// be kept. Default is the current directory from which the
@@ -1473,7 +1692,6 @@ BE_GlobalData::parse_args (long &i, char **av)
if (av[i][2] == '\0')
{
idl_global->append_idl_flag (av[i + 1]);
-
int result = ACE_OS::mkdir (av[i + 1]);
#if !defined (__BORLANDC__)
@@ -1491,25 +1709,24 @@ BE_GlobalData::parse_args (long &i, char **av)
av[i + 1]
));
- ACE_OS::exit (99);
+ break;
}
- be_global->output_dir (av [i + 1]);
- i++;
+ be_global->output_dir (av[i + 1]);
+ ++i;
}
else if (av[i][2] == 'A')
{
if (av[i][3] == '\0')
{
idl_global->append_idl_flag (av[i + 1]);
-
int result = ACE_OS::mkdir (av[i + 1]);
#if !defined (__BORLANDC__)
if (result != 0 && errno != EEXIST)
#else
- // The Borland RTL doesn't give EEXIST back, only EACCES in case
- // the directory exists, reported to Borland as QC 9495
+ // The Borland RTL doesn't give EEXIST back, only EACCES in
+ // case the directory exists, reported to Borland as QC 9495
if (result != 0 && errno != EEXIST && errno != EACCES)
#endif
{
@@ -1520,11 +1737,11 @@ BE_GlobalData::parse_args (long &i, char **av)
av[i + 1]
));
- ACE_OS::exit (99);
+ break;
}
- be_global->anyop_output_dir (av [i + 1]);
- i++;
+ be_global->anyop_output_dir (av[i + 1]);
+ ++i;
}
else
{
@@ -1534,8 +1751,6 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT (" the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
}
else
@@ -1546,9 +1761,8 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT (" the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
case 'G':
// Enable generation of ...
@@ -1575,23 +1789,22 @@ BE_GlobalData::parse_args (long &i, char **av)
}
else if (av[i][2] == 'e')
{
- idl_global->append_idl_flag (av[i+1]);
- int option = ACE_OS::atoi (av[i+1]);
+ idl_global->append_idl_flag (av[i + 1]);
+ int option = ACE_OS::atoi (av[i + 1]);
- // exception support
+ // Exception support.
be_global->exception_support (option == 0
|| option == 2);
- // use of raw 'throw'
+ // Use of raw 'throw'.
be_global->use_raw_throw (option == 2);
-
- i++;
+ ++i;
}
else if (av[i][2] == 's')
{
if (av[i][3] == 'p')
{
- // smart proxies
+ // Smart proxies.
be_global->gen_smart_proxies (true);
}
else
@@ -1602,8 +1815,6 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
break;
@@ -1612,7 +1823,7 @@ BE_GlobalData::parse_args (long &i, char **av)
{
if (av[i][3] == 'c')
{
- // inline constants
+ // Inline constants.
be_global->gen_inline_constants (false);
}
else
@@ -1623,21 +1834,19 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
break;
}
else if (av[i][2] == 't')
{
- // optimized typecode support
+ // Optimized typecode generation.
be_global->opt_tc (1);
}
else if (av[i][2] == 'p')
{
- // generating Thru_POA collocated stubs.
- be_global->gen_thru_poa_collocation (1);
+ // Generating Thru_POA collocated stubs.
+ be_global->gen_thru_poa_collocation (true);
}
else if (av[i][2] == 'd')
{
@@ -1645,7 +1854,7 @@ BE_GlobalData::parse_args (long &i, char **av)
{
if (av[i][4] == 'p' && av[i][5] =='s' && '\0' == av[i][6])
{
- // DDS DCSP type support
+ // DDS DCSP type support.
be_global->gen_dcps_type_support (true);
}
else
@@ -1656,33 +1865,29 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
}
else if ('\0' == av[i][3])
{
- // generating Direct collocated stubs.
- be_global->gen_direct_collocation (1);
- }
- else
- {
- ACE_ERROR ((
- LM_ERROR,
- ACE_TEXT ("IDL: I don't understand ")
- ACE_TEXT ("the '%s' option\n"),
- av[i]
- ));
-
- ACE_OS::exit (99);
- }
+ // Generating Direct collocated stubs.
+ be_global->gen_direct_collocation (true);
+ }
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand ")
+ ACE_TEXT ("the '%s' option\n"),
+ av[i]
+ ));
+ }
}
else if (av[i][2] == 'I')
{
- size_t options = ACE_OS::strlen(av[i]) - 3;
+ size_t options = ACE_OS::strlen (av[i]) - 3;
size_t j;
size_t k = i;
- // generate implementation files.
+ // Generate implementation files.
be_global->gen_impl_files (1);
for (j = 0; j < options; ++j)
@@ -1691,37 +1896,37 @@ BE_GlobalData::parse_args (long &i, char **av)
{
idl_global->append_idl_flag (av[i + 1]);
be_global->implementation_skel_ending (av[i + 1]);
- i++;
+ ++i;
}
else if (av[k][j + 3] == 'h')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->implementation_hdr_ending (av[i + 1]);
- i++;
+ ++i;
}
else if (av[k][j + 3] == 'b')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->impl_class_prefix (av[i + 1]);
- i++;
+ ++i;
}
else if (av[k][j + 3] == 'e')
{
idl_global->append_idl_flag (av[i + 1]);
be_global->impl_class_suffix (av[i + 1]);
- i++;
+ ++i;
}
else if (av[k][j + 3] == 'c')
{
- be_global->gen_copy_ctor (1);
+ be_global->gen_copy_ctor (true);
}
else if (av[k][j + 3] == 'a')
{
- be_global->gen_assign_op (1);
+ be_global->gen_assign_op (true);
}
else if (av[k][j + 3] == 'd')
{
- be_global->gen_impl_debug_info (1);
+ be_global->gen_impl_debug_info (true);
}
else if (isalpha (av[k][j + 3] ))
{
@@ -1746,57 +1951,64 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
case 'S':
- // suppress generation of ...
+ // Suppress generation of...
if (av[i][2] == 'a')
{
- // suppress Any support
- be_global->any_support (false);
+ if (av[i][3] == 'l')
+ {
+ // Suppress Any support for local interfaces.
+ be_global->gen_local_iface_anyops (false);
+ }
+ else
+ {
+ // Suppress all Any support.
+ be_global->any_support (false);
+ }
}
else if (av[i][2] == 't')
{
- // suppress typecode support
- // Anys must be suppressed as well
+ // Suppress typecode generation
+ // Anys must be suppressed as well.
be_global->tc_support (false);
be_global->any_support (false);
}
else if (av[i][2] == 'p')
{
- // suppress generating Thru_POA collocated stubs
+ // Suppress generating Thru_POA collocated stubs.
be_global->gen_thru_poa_collocation (false);
}
else if (av[i][2] == 'd')
{
- // suppress generating Direct collocated stubs
+ // sSppress generating Direct collocated stubs.
be_global->gen_direct_collocation (false);
}
else if (av[i][2] == 'c')
{
if (av[i][3] == 'i')
{
- // no client inline
+ // No stub inline.
be_global->gen_client_inline (false);
}
}
else if (av[i][2] == 'm')
{
- // turn off ccm preprocessing.
+ // Turn off ccm preprocessing.
idl_global->ignore_idl3 (true);
}
else if (av[i][2] == 'S')
{
- // disable skeleton file generation.
+ // Disable skeleton file generation.
be_global->gen_skel_files (false);
}
else if (av[i][2] == 's')
{
if (av[i][3] == 'i')
{
- // no client inline
+ // No skeleton inline.
be_global->gen_server_inline (false);
}
else
@@ -1815,9 +2027,8 @@ BE_GlobalData::parse_args (long &i, char **av)
ACE_TEXT ("IDL: I don't understand the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
}
+
break;
default:
ACE_ERROR ((
@@ -1991,14 +2202,12 @@ BE_GlobalData::arg_post_proc (void)
}
#endif /* ACE_HAS_GPERF */
- // make sure that we are not suppressing TypeCode generation and asking for
- // optimized typecode support at the same time
+ // Make sure that we are not suppressing TypeCode generation and asking for
+ // optimized typecode support at the same time.
if (!be_global->tc_support () && be_global->opt_tc ())
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Bad Combination -St and -Gt \n")));
-
- ACE_OS::exit (99);
}
}
@@ -2274,6 +2483,12 @@ BE_GlobalData::usage (void) const
));
ACE_DEBUG ((
LM_DEBUG,
+ ACE_TEXT (" -Sal\t\t\tsuppress Any support")
+ ACE_TEXT (" for local interfaces")
+ ACE_TEXT (" (support enabled by default)\n")
+ ));
+ ACE_DEBUG ((
+ LM_DEBUG,
ACE_TEXT (" -St\t\t\tsuppress TypeCode support")
ACE_TEXT (" (support enabled by default)\n")
));
@@ -2313,6 +2528,7 @@ AST_Generator *
BE_GlobalData::generator_init (void)
{
tao_cg = TAO_CODEGEN::instance ();
+ tao_cg->config_visitor_factory ();
AST_Generator *gen = 0;
ACE_NEW_RETURN (gen,
diff --git a/TAO/TAO_IDL/be/be_home.cpp b/TAO/TAO_IDL/be/be_home.cpp
index 4ebcd57d557..f7ddaac8f5e 100644
--- a/TAO/TAO_IDL/be/be_home.cpp
+++ b/TAO/TAO_IDL/be/be_home.cpp
@@ -19,6 +19,7 @@
#include "be_home.h"
#include "be_component.h"
+#include "be_interface_strategy.h"
#include "be_visitor.h"
#include "global_extern.h"
#include "utl_err.h"
@@ -107,8 +108,20 @@ be_home::~be_home (void)
void
be_home::destroy (void)
{
- // Can't call be_interface->destroy() because all the
- // home's decls are also added to the explicit interface.
+ // Skip be_interface, since our decls were added to
+ // the equivalent interface and will get destroyed
+ // there.
+ if (this->strategy_ != 0)
+ {
+ this->strategy_->destroy ();
+ delete this->strategy_;
+ this->strategy_ = 0;
+ }
+
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+
+ // This skips AST_Interface, for the reason above.
this->AST_Home::destroy ();
}
diff --git a/TAO/TAO_IDL/be/be_init.cpp b/TAO/TAO_IDL/be/be_init.cpp
index 3cb9fac5979..65fee2a4821 100644
--- a/TAO/TAO_IDL/be/be_init.cpp
+++ b/TAO/TAO_IDL/be/be_init.cpp
@@ -1,7 +1,5 @@
// $Id$
-#include "ast_predefined_type.h"
-#include "utl_identifier.h"
#include "global_extern.h"
#include "be_extern.h"
#include "../../tao/Version.h"
@@ -18,20 +16,16 @@ BE_version (void)
TAO_IDL_BE_Export int
BE_init (int &, char *[])
{
+ // Initialize BE global data object.
+ ACE_NEW_RETURN (be_global,
+ BE_GlobalData,
+ -1);
+
return 0;
}
TAO_IDL_BE_Export void
-BE_post_init (const char *[], long)
+BE_post_init (char *[], long)
{
- Identifier id ("void");
- UTL_ScopedName n (&id,
- 0);
- AST_Decl *d =
- idl_global->scopes ().bottom ()->lookup_primitive_type (
- AST_Expression::EV_void
- );
- be_global->void_type (AST_PredefinedType::narrow_from_decl (d));
- id.destroy ();
}
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 228129670f8..b732c0eddbb 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -95,6 +95,7 @@ be_interface::be_interface (UTL_ScopedName *n,
var_out_seq_decls_gen_ (0),
skel_count_ (0),
in_mult_inheritance_ (-1),
+ strategy_ (0),
original_interface_ (0),
has_mixed_parentage_ (-1),
session_component_child_ (-1)
@@ -138,12 +139,6 @@ be_interface::be_interface (UTL_ScopedName *n,
be_interface::~be_interface (void)
{
- // We know that it cannot be 0, but..
- if (this->strategy_ != 0)
- {
- delete this->strategy_;
- this->strategy_ = 0;
- }
}
be_interface_strategy *
@@ -170,7 +165,6 @@ be_interface::local_name (void) const
const char *
be_interface::full_name (void)
{
- // Return the stringified full name.
return this->strategy_->full_name ();
}
@@ -1661,7 +1655,7 @@ be_interface::gen_gperf_lookup_methods (const char *flat_name)
"fclose"),
-1);
}
-
+
// Open the temp file.
ACE_HANDLE input = ACE::open_temp_file (tao_cg->gperf_input_filename (),
O_RDONLY);
@@ -2377,6 +2371,14 @@ be_interface::gen_throw_spec (UTL_ExceptList *list,
void
be_interface::destroy (void)
{
+ // We know that it cannot be 0, but..
+ if (this->strategy_ != 0)
+ {
+ this->strategy_->destroy ();
+ delete this->strategy_;
+ this->strategy_ = 0;
+ }
+
// Call the destroy methods of our base classes.
this->AST_Interface::destroy ();
this->be_scope::destroy ();
@@ -2430,6 +2432,13 @@ be_interface::has_mixed_parentage (void)
return 0;
}
+ AST_Decl::NodeType nt = this->node_type ();
+
+ if (AST_Decl::NT_component == nt || AST_Decl::NT_home == nt)
+ {
+ return 0;
+ }
+
if (this->has_mixed_parentage_ == -1)
{
this->analyze_parentage ();
diff --git a/TAO/TAO_IDL/be/be_interface_fwd.cpp b/TAO/TAO_IDL/be/be_interface_fwd.cpp
index 6577daeeabf..cc57b19e1f4 100644
--- a/TAO/TAO_IDL/be/be_interface_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_interface_fwd.cpp
@@ -93,7 +93,8 @@ be_interface_fwd::seen_in_operation (bool val)
void
be_interface_fwd::destroy (void)
{
- // Do nothing.
+ this->be_type::destroy ();
+ this->AST_InterfaceFwd::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_interface_strategy.cpp b/TAO/TAO_IDL/be/be_interface_strategy.cpp
index 2973199f67e..29894b7e2ae 100644
--- a/TAO/TAO_IDL/be/be_interface_strategy.cpp
+++ b/TAO/TAO_IDL/be/be_interface_strategy.cpp
@@ -45,53 +45,6 @@ be_interface_strategy::be_interface_strategy (be_interface *node,
be_interface_strategy::~be_interface_strategy (void)
{
- if (this->local_name_ != 0)
- {
- delete [] this->local_name_;
- this->local_name_ = 0;
- }
-
- if (this->full_name_ != 0)
- {
- delete [] this->full_name_;
- this->full_name_ = 0;
- }
-
- if (this->flat_name_ != 0)
- {
- delete [] this->flat_name_;
- this->flat_name_ = 0;
- }
-
- if (this->repoID_ != 0)
- {
- delete [] this->repoID_;
- this->repoID_ = 0;
- }
-
- if (this->full_skel_name_ != 0)
- {
- delete [] this->full_skel_name_;
- this->full_skel_name_ = 0;
- }
-
- if (this->full_coll_name_ != 0)
- {
- delete [] this->full_coll_name_;
- this->full_coll_name_ = 0;
- }
-
- if (this->local_coll_name_ != 0)
- {
- delete [] this->local_coll_name_;
- this->local_coll_name_ = 0;
- }
-
- if (this->relative_skel_name_ != 0)
- {
- delete [] this->relative_skel_name_;
- this->relative_skel_name_ = 0;
- }
}
// Interface Type Strategy Base Class
@@ -352,155 +305,58 @@ be_interface_strategy::replacement (void)
return 0;
}
-
-// ****************************************************************
-// AMI Handler Strategy
-
-be_interface_ami_handler_strategy::be_interface_ami_handler_strategy (
- be_interface *node
- )
- : be_interface_default_strategy (node,
- AMI_HANDLER)
-{
-}
-
-be_interface_ami_handler_strategy::~be_interface_ami_handler_strategy (void)
-{
-}
-
-
-TAO_CodeGen::CG_STATE
-be_interface_ami_handler_strategy::next_state (
- TAO_CodeGen::CG_STATE current_state,
- int /*is_extra_state */
- )
-{
- return current_state;
-}
-
-
-// ****************************************************************
-// AMI Exception Holder Strategy
-
-be_interface_ami_exception_holder_strategy::
-be_interface_ami_exception_holder_strategy (be_interface *node)
- : be_interface_default_strategy (node,
- AMI_EXCEPTION_HOLDER)
-{
-}
-
-be_interface_ami_exception_holder_strategy
-::~be_interface_ami_exception_holder_strategy (void)
-{
-}
-
-
-TAO_CodeGen::CG_STATE
-be_interface_ami_exception_holder_strategy::next_state (
- TAO_CodeGen::CG_STATE current_state,
- int is_extra_state
- )
+void
+be_interface_strategy::destroy (void)
{
- if (is_extra_state)
+ if (this->local_name_ != 0)
{
- switch (current_state)
- {
- case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
- return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH;
- case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
- return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS;
- default:
- return current_state;
- }
+ delete [] this->local_name_;
+ this->local_name_ = 0;
}
- else
+
+ if (this->full_name_ != 0)
{
- return current_state;
+ delete [] this->full_name_;
+ this->full_name_ = 0;
}
-}
-
-int
-be_interface_ami_exception_holder_strategy::has_extra_code_generation (
- TAO_CodeGen::CG_STATE current_state
- )
-{
- if (current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CH
- || current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CS)
+ if (this->flat_name_ != 0)
{
- return 1;
+ delete [] this->flat_name_;
+ this->flat_name_ = 0;
}
- else
+
+ if (this->repoID_ != 0)
{
- return 0;
+ delete [] this->repoID_;
+ this->repoID_ = 0;
}
-}
-
-// ****************************************************************
-// AMI Strategy
-
-be_interface_ami_strategy::be_interface_ami_strategy (be_interface *node,
- be_interface *handler)
- : be_interface_default_strategy (node,
- AMI_INTERFACE),
- handler_ (handler)
-{
-}
-
-be_interface_ami_strategy::~be_interface_ami_strategy (void)
-{
-}
-
-
-TAO_CodeGen::CG_STATE
-be_interface_ami_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state)
-{
- if (is_extra_state)
+ if (this->full_skel_name_ != 0)
{
- switch (current_state)
- {
- case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
- return TAO_CodeGen::TAO_INTERFACE_CH;
- default:
- return current_state;
- }
+ delete [] this->full_skel_name_;
+ this->full_skel_name_ = 0;
}
- else
+
+ if (this->full_coll_name_ != 0)
{
- switch (current_state)
- {
- case TAO_CodeGen::TAO_INTERFACE_CH:
- return TAO_CodeGen::TAO_AMI_INTERFACE_CH;
- default:
- return current_state;
- }
+ delete [] this->full_coll_name_;
+ this->full_coll_name_ = 0;
}
-}
-
-int
-be_interface_ami_strategy::has_extra_code_generation (
- TAO_CodeGen::CG_STATE current_state
- )
-{
- if (current_state == TAO_CodeGen::TAO_AMI_INTERFACE_CH)
+ if (this->local_coll_name_ != 0)
{
- return 1;
+ delete [] this->local_coll_name_;
+ this->local_coll_name_ = 0;
}
- else
+
+ if (this->relative_skel_name_ != 0)
{
- return 0;
+ delete [] this->relative_skel_name_;
+ this->relative_skel_name_ = 0;
}
}
-be_interface *
-be_interface_ami_strategy::replacement (void)
-{
- return handler_;
-}
-
// ****************************************************************
// Default Strategy
@@ -547,101 +403,6 @@ be_interface_default_strategy::be_interface_default_strategy (
be_interface_default_strategy::~be_interface_default_strategy (void)
{
- if (this->base_proxy_impl_name_ != 0)
- {
- delete [] this->base_proxy_impl_name_;
- this->base_proxy_impl_name_ = 0;
- }
-
- if (this->remote_proxy_impl_name_ != 0)
- {
- delete [] this->remote_proxy_impl_name_;
- this->remote_proxy_impl_name_ = 0;
- }
-
- if (this->direct_proxy_impl_name_ != 0)
- {
- delete [] this->direct_proxy_impl_name_;
- this->direct_proxy_impl_name_ = 0;
- }
-
- if (this->full_base_proxy_impl_name_ != 0)
- {
- delete [] this->full_base_proxy_impl_name_;
- this->full_base_proxy_impl_name_ = 0;
- }
-
- if (this->full_remote_proxy_impl_name_ != 0)
- {
- delete [] this->full_remote_proxy_impl_name_;
- this->full_remote_proxy_impl_name_ = 0;
- }
-
- if (this->full_direct_proxy_impl_name_ != 0)
- {
- delete [] this->full_direct_proxy_impl_name_;
- this->full_direct_proxy_impl_name_ = 0;
- }
-
- if (this->base_proxy_broker_ != 0)
- {
- delete [] this->base_proxy_broker_;
- this->base_proxy_broker_ = 0;
- }
-
- if (this->remote_proxy_broker_ != 0)
- {
- delete [] this->remote_proxy_broker_;
- this->remote_proxy_broker_ = 0;
- }
-
- if (this->strategized_proxy_broker_ != 0)
- {
- delete [] this->strategized_proxy_broker_;
- this->strategized_proxy_broker_ = 0;
- }
-
- if (this->full_base_proxy_broker_name_ != 0)
- {
- delete [] this->full_base_proxy_broker_name_;
- this->full_base_proxy_broker_name_ = 0;
- }
-
- if (this->full_remote_proxy_broker_name_ != 0)
- {
- delete [] this->full_remote_proxy_broker_name_;
- this->full_remote_proxy_broker_name_ = 0;
- }
-
- if (this->full_strategized_proxy_broker_name_ != 0)
- {
- delete [] this->full_strategized_proxy_broker_name_;
- this->full_strategized_proxy_broker_name_ = 0;
- }
-
- if (this->client_scope_ != 0)
- {
- delete [] this->client_scope_;
- this->client_scope_ = 0;
- }
-
- if (this->flat_client_scope_ != 0)
- {
- delete [] this->flat_client_scope_;
- this->flat_client_scope_ = 0;
- }
-
- if (this->server_scope_ != 0)
- {
- delete [] this->server_scope_;
- this->server_scope_ = 0;
- }
-
- if (this->flat_server_scope_ != 0)
- {
- delete [] this->flat_server_scope_;
- this->flat_server_scope_ = 0;
- }
}
const char *
@@ -1110,3 +871,254 @@ be_interface_default_strategy::full_strategized_proxy_broker_name (void)
return this->full_strategized_proxy_broker_name_;
}
+
+void
+be_interface_default_strategy::destroy (void)
+{
+ if (this->base_proxy_impl_name_ != 0)
+ {
+ delete [] this->base_proxy_impl_name_;
+ this->base_proxy_impl_name_ = 0;
+ }
+
+ if (this->remote_proxy_impl_name_ != 0)
+ {
+ delete [] this->remote_proxy_impl_name_;
+ this->remote_proxy_impl_name_ = 0;
+ }
+
+ if (this->direct_proxy_impl_name_ != 0)
+ {
+ delete [] this->direct_proxy_impl_name_;
+ this->direct_proxy_impl_name_ = 0;
+ }
+
+ if (this->full_base_proxy_impl_name_ != 0)
+ {
+ delete [] this->full_base_proxy_impl_name_;
+ this->full_base_proxy_impl_name_ = 0;
+ }
+
+ if (this->full_remote_proxy_impl_name_ != 0)
+ {
+ delete [] this->full_remote_proxy_impl_name_;
+ this->full_remote_proxy_impl_name_ = 0;
+ }
+
+ if (this->full_direct_proxy_impl_name_ != 0)
+ {
+ delete [] this->full_direct_proxy_impl_name_;
+ this->full_direct_proxy_impl_name_ = 0;
+ }
+
+ if (this->base_proxy_broker_ != 0)
+ {
+ delete [] this->base_proxy_broker_;
+ this->base_proxy_broker_ = 0;
+ }
+
+ if (this->remote_proxy_broker_ != 0)
+ {
+ delete [] this->remote_proxy_broker_;
+ this->remote_proxy_broker_ = 0;
+ }
+
+ if (this->strategized_proxy_broker_ != 0)
+ {
+ delete [] this->strategized_proxy_broker_;
+ this->strategized_proxy_broker_ = 0;
+ }
+
+ if (this->full_base_proxy_broker_name_ != 0)
+ {
+ delete [] this->full_base_proxy_broker_name_;
+ this->full_base_proxy_broker_name_ = 0;
+ }
+
+ if (this->full_remote_proxy_broker_name_ != 0)
+ {
+ delete [] this->full_remote_proxy_broker_name_;
+ this->full_remote_proxy_broker_name_ = 0;
+ }
+
+ if (this->full_strategized_proxy_broker_name_ != 0)
+ {
+ delete [] this->full_strategized_proxy_broker_name_;
+ this->full_strategized_proxy_broker_name_ = 0;
+ }
+
+ if (this->client_scope_ != 0)
+ {
+ delete [] this->client_scope_;
+ this->client_scope_ = 0;
+ }
+
+ if (this->flat_client_scope_ != 0)
+ {
+ delete [] this->flat_client_scope_;
+ this->flat_client_scope_ = 0;
+ }
+
+ if (this->server_scope_ != 0)
+ {
+ delete [] this->server_scope_;
+ this->server_scope_ = 0;
+ }
+
+ if (this->flat_server_scope_ != 0)
+ {
+ delete [] this->flat_server_scope_;
+ this->flat_server_scope_ = 0;
+ }
+
+ this->be_interface_strategy::destroy ();
+}
+
+// ****************************************************************
+// AMI Handler Strategy
+
+be_interface_ami_handler_strategy::be_interface_ami_handler_strategy (
+ be_interface *node
+ )
+ : be_interface_default_strategy (node,
+ AMI_HANDLER)
+{
+}
+
+be_interface_ami_handler_strategy::~be_interface_ami_handler_strategy (void)
+{
+}
+
+
+TAO_CodeGen::CG_STATE
+be_interface_ami_handler_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int /*is_extra_state */
+ )
+{
+ return current_state;
+}
+
+
+// ****************************************************************
+// AMI Exception Holder Strategy
+
+be_interface_ami_exception_holder_strategy::
+be_interface_ami_exception_holder_strategy (be_interface *node)
+ : be_interface_default_strategy (node,
+ AMI_EXCEPTION_HOLDER)
+{
+}
+
+be_interface_ami_exception_holder_strategy
+::~be_interface_ami_exception_holder_strategy (void)
+{
+}
+
+
+TAO_CodeGen::CG_STATE
+be_interface_ami_exception_holder_strategy::next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state
+ )
+{
+ if (is_extra_state)
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CH:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CH;
+ case TAO_CodeGen::TAO_VALUETYPE_OBV_CS:
+ return TAO_CodeGen::TAO_AMI_EXCEPTION_HOLDER_VALUETYPE_CS;
+ default:
+ return current_state;
+ }
+ }
+ else
+ {
+ return current_state;
+ }
+}
+
+
+int
+be_interface_ami_exception_holder_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
+{
+ if (current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CH
+ || current_state == TAO_CodeGen::TAO_VALUETYPE_OBV_CS)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
+// ****************************************************************
+// AMI Strategy
+
+be_interface_ami_strategy::be_interface_ami_strategy (be_interface *node,
+ be_interface *handler)
+ : be_interface_default_strategy (node,
+ AMI_INTERFACE),
+ handler_ (handler)
+{
+}
+
+be_interface_ami_strategy::~be_interface_ami_strategy (void)
+{
+}
+
+
+TAO_CodeGen::CG_STATE
+be_interface_ami_strategy::next_state (TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state)
+{
+ if (is_extra_state)
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_AMI_INTERFACE_CH:
+ return TAO_CodeGen::TAO_INTERFACE_CH;
+ default:
+ return current_state;
+ }
+ }
+ else
+ {
+ switch (current_state)
+ {
+ case TAO_CodeGen::TAO_INTERFACE_CH:
+ return TAO_CodeGen::TAO_AMI_INTERFACE_CH;
+ default:
+ return current_state;
+ }
+ }
+}
+
+
+int
+be_interface_ami_strategy::has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ )
+{
+ if (current_state == TAO_CodeGen::TAO_AMI_INTERFACE_CH)
+ {
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+be_interface *
+be_interface_ami_strategy::replacement (void)
+{
+ return handler_;
+}
+
diff --git a/TAO/TAO_IDL/be/be_module.cpp b/TAO/TAO_IDL/be/be_module.cpp
index e3a23c01475..363585e7d47 100644
--- a/TAO/TAO_IDL/be/be_module.cpp
+++ b/TAO/TAO_IDL/be/be_module.cpp
@@ -51,8 +51,9 @@ void
be_module::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_decl::destroy ();
+ this->be_scope::destroy ();
+ this->be_decl::destroy ();
+ this->AST_Module::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_native.cpp b/TAO/TAO_IDL/be/be_native.cpp
index be5d28e0091..5174efd0f5d 100644
--- a/TAO/TAO_IDL/be/be_native.cpp
+++ b/TAO/TAO_IDL/be/be_native.cpp
@@ -78,6 +78,13 @@ be_native::tc_size (void)
return 0;
}
+void
+be_native::destroy (void)
+{
+ this->be_exception::destroy ();
+ this->AST_Native::destroy ();
+}
+
int
be_native::accept (be_visitor *visitor)
{
diff --git a/TAO/TAO_IDL/be/be_operation.cpp b/TAO/TAO_IDL/be/be_operation.cpp
index 7fc7ba0f21b..40e2f7bd36b 100644
--- a/TAO/TAO_IDL/be/be_operation.cpp
+++ b/TAO/TAO_IDL/be/be_operation.cpp
@@ -88,8 +88,12 @@ be_operation::~be_operation (void)
void
be_operation::destroy (void)
{
- delete this->strategy_;
- this->strategy_ = 0;
+ if (0 != this->strategy_)
+ {
+ this->strategy_->destroy ();
+ delete this->strategy_;
+ this->strategy_ = 0;
+ }
// Call the destroy methods of our base classes.
this->be_scope::destroy ();
diff --git a/TAO/TAO_IDL/be/be_operation_strategy.cpp b/TAO/TAO_IDL/be/be_operation_strategy.cpp
index 268a092ec3a..d4af00fa11b 100644
--- a/TAO/TAO_IDL/be/be_operation_strategy.cpp
+++ b/TAO/TAO_IDL/be/be_operation_strategy.cpp
@@ -18,6 +18,7 @@
// ============================================================================
#include "be_operation_strategy.h"
+#include "be_operation.h"
ACE_RCSID (be,
be_operation_strategy,
@@ -55,13 +56,23 @@ be_operation_strategy::marshaling (void)
return 0;
}
-
be_operation *
be_operation_strategy::arguments (void)
{
return 0;
}
+be_operation_strategy *
+be_operation_strategy::copy (void)
+{
+ return 0;
+}
+
+void
+be_operation_strategy::destroy (void)
+{
+}
+
// ****************************************************************
// AMI sendc_ operation strategy
@@ -77,7 +88,6 @@ be_operation_default_strategy::~be_operation_default_strategy (void)
{
}
-
TAO_CodeGen::CG_STATE
be_operation_default_strategy::next_state (
TAO_CodeGen::CG_STATE current_state,
@@ -87,7 +97,16 @@ be_operation_default_strategy::next_state (
return current_state;
}
-
+be_operation_strategy *
+be_operation_default_strategy::copy (void)
+{
+ be_operation_default_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_default_strategy (this->node_),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
// ****************************************************************
// AMI sendc_ operation strategy
@@ -100,7 +119,8 @@ be_operation_ami_sendc_strategy::be_operation_ami_sendc_strategy (
: be_operation_strategy (node,
AMI_SENDC),
marshaling_ (marshaling),
- arguments_ (arguments)
+ arguments_ (arguments),
+ owns_operations_ (true)
{
}
@@ -108,7 +128,6 @@ be_operation_ami_sendc_strategy::~be_operation_ami_sendc_strategy (void)
{
}
-
TAO_CodeGen::CG_STATE
be_operation_ami_sendc_strategy::next_state (
TAO_CodeGen::CG_STATE current_state,
@@ -149,7 +168,6 @@ be_operation_ami_sendc_strategy::has_extra_code_generation (
}
}
-
be_operation*
be_operation_ami_sendc_strategy::marshaling (void)
{
@@ -163,6 +181,37 @@ be_operation_ami_sendc_strategy::arguments (void)
return arguments_;
}
+be_operation_strategy *
+be_operation_ami_sendc_strategy::copy (void)
+{
+ be_operation_ami_sendc_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_ami_sendc_strategy (this->node_,
+ this->marshaling_,
+ this->arguments_),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ retval->owns_operations_ = false;
+ return retval;
+}
+
+void
+be_operation_ami_sendc_strategy::destroy (void)
+{
+ if (this->owns_operations_)
+ {
+ this->marshaling_->destroy ();
+ delete this->marshaling_;
+ this->marshaling_ = 0;
+
+ this->arguments_->destroy ();
+ delete this->arguments_;
+ this->arguments_ = 0;
+ }
+
+ this->be_operation_strategy::destroy ();
+}
+
// ****************************************************************
// AMI ExceptionHolder raise_ operation strategy
@@ -201,6 +250,18 @@ be_operation_ami_exception_holder_raise_strategy::next_state (
}
}
+be_operation_strategy *
+be_operation_ami_exception_holder_raise_strategy::copy (void)
+{
+ be_operation_ami_exception_holder_raise_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_ami_exception_holder_raise_strategy (
+ this->node_
+ ),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
// ****************************************************************
// AMI Reply Handler reply stub operation strategy
@@ -217,7 +278,6 @@ be_operation_ami_handler_reply_stub_strategy
{
}
-
TAO_CodeGen::CG_STATE
be_operation_ami_handler_reply_stub_strategy::next_state (
TAO_CodeGen::CG_STATE current_state,
@@ -244,7 +304,6 @@ be_operation_ami_handler_reply_stub_strategy::next_state (
}
}
-
int
be_operation_ami_handler_reply_stub_strategy::has_extra_code_generation (
TAO_CodeGen::CG_STATE current_state
@@ -261,6 +320,16 @@ be_operation_ami_handler_reply_stub_strategy::has_extra_code_generation (
}
}
+be_operation_strategy *
+be_operation_ami_handler_reply_stub_strategy::copy (void)
+{
+ be_operation_ami_handler_reply_stub_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_ami_handler_reply_stub_strategy (this->node_),
+ 0);
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
// ****************************************************************
// AMH Strategy
@@ -274,7 +343,6 @@ be_operation_amh_strategy::~be_operation_amh_strategy (void)
{
}
-
TAO_CodeGen::CG_STATE
be_operation_amh_strategy::next_state (
TAO_CodeGen::CG_STATE current_state,
@@ -299,3 +367,15 @@ be_operation_amh_strategy::has_extra_code_generation (
{
return 0;
}
+
+be_operation_strategy *
+be_operation_amh_strategy::copy (void)
+{
+ be_operation_amh_strategy *retval = 0;
+ ACE_NEW_RETURN (retval,
+ be_operation_amh_strategy (this->node_),
+ 0);
+ retval->arguments_ = this->arguments_;
+ retval->strategy_type_ = this->strategy_type_;
+ return retval;
+}
diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp
index 613be8a7c7c..0d1c7a6b69b 100644
--- a/TAO/TAO_IDL/be/be_predefined_type.cpp
+++ b/TAO/TAO_IDL/be/be_predefined_type.cpp
@@ -28,8 +28,8 @@
#include "ace/ACE.h"
#include "ace/OS_NS_stdio.h"
-ACE_RCSID (be,
- be_predefined_type,
+ACE_RCSID (be,
+ be_predefined_type,
"$Id$")
be_predefined_type::be_predefined_type (void)
@@ -213,7 +213,8 @@ be_predefined_type::compute_repoID (void)
switch (this->pt ())
{
case AST_PredefinedType::PT_object:
- this->repoID_ = ACE::strnew ("IDL:omg.org/CORBA/Object:1.0");
+ ACE::strdelete (this->repoID_);
+ this->repoID_ = ACE::strnew ("IDL:omg.org/CORBA/Object:1.0");
break;
default:
AST_Decl::compute_repoID ();
diff --git a/TAO/TAO_IDL/be/be_produce.cpp b/TAO/TAO_IDL/be/be_produce.cpp
index 2e7c41fe210..3e749b5c50c 100644
--- a/TAO/TAO_IDL/be/be_produce.cpp
+++ b/TAO/TAO_IDL/be/be_produce.cpp
@@ -71,6 +71,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "be_visitor_context.h"
#include "be_root.h"
#include "be_extern.h"
+#include "fe_extern.h"
#include "global_extern.h"
ACE_RCSID (be,
@@ -91,191 +92,89 @@ BE_abort (void)
ACE_ERROR ((LM_ERROR,
"Fatal Error - Aborting\n"));
- BE_cleanup ();
+ // BE_cleanup will be called after the exception is caught.
+ throw FE_Bailout ();
+}
- ACE_OS::exit (1);
+void
+BE_visit_root (be_visitor_decl &root_visitor, const char *which_pass)
+{
+ static be_root *root =
+ be_root::narrow_from_decl (idl_global->root ());
+
+ if (-1 == root->accept (&root_visitor))
+ {
+ ACE_ERROR ((LM_ERROR,
+ "BE_visit_root - %s for Root failed\n",
+ which_pass));
+ BE_abort ();
+ }
+
+ root_visitor.ctx ()->reset ();
}
// Do the work of this BE. This is the starting point for code generation.
TAO_IDL_BE_Export void
BE_produce (void)
{
- // Root of the AST made up of BE nodes.
- be_root *root = 0;
-
- // Context information for the visitor root.
be_visitor_context ctx;
- // Configure the CodeGen object with the strategy to generate the visitors.
- tao_cg->config_visitor_factory ();
-
- // Get the root node and narrow it down to be the back-end root node.
- AST_Decl *d = idl_global->root ();
- root = be_root::narrow_from_decl (d);
-
- if (root == 0)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "No Root\n"));
- BE_abort ();
- }
-
if (!idl_global->ignore_idl3 ())
{
- // Make a pass over the AST and introduce
- // CCM specific nodes.
be_visitor_ccm_pre_proc ccm_preproc_visitor (&ctx);
-
- if (root->accept (&ccm_preproc_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "CCM preprocessing for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (ccm_preproc_visitor, "CCM preprocessing");
}
if (be_global->ami_call_back ())
{
- // Make a pass over the AST and introduce
- // AMI specific interfaces, methods and valuetypes.
be_visitor_ami_pre_proc ami_preproc_visitor (&ctx);
-
- if (root->accept (&ami_preproc_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "AMI preprocessing for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (ami_preproc_visitor, "AMI preprocessing");
}
if (be_global->gen_amh_classes ())
{
- // Make a pass over the AST and introduce
- // AMH specific code
be_visitor_amh_pre_proc amh_pre_proc_visitor (&ctx);
-
- if (root->accept (&amh_pre_proc_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "AMH preprocessing for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (amh_pre_proc_visitor, "AMH preprocessing");
}
- // (1) Generate client header,
- // instantiate a visitor context, and set the codegen state
- ctx.state (TAO_CodeGen::TAO_ROOT_CH);
-
- // Get a root visitor.
- be_visitor_root_ch root_ch_visitor (&ctx);
-
- // Initialize the anyop header stream, if the option is set.
- if (be_global->gen_anyop_files ())
+ const char *fname = be_global->be_get_anyop_header_fname ();
+
+ // No-op if the -GA wasn't on the command line.
+ if (-1 == tao_cg->start_anyop_header (fname))
{
- int status = 0;
-
- status =
- tao_cg->start_anyop_header (
- be_global->be_get_anyop_header_fname ()
- );
-
- if (status == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) TAO_CodeGen::"
- "TAO_CodeGen - "
- "Error opening anyop header file\n"));
- }
- }
-
- // Generate code for the client header
- if (root->accept (&root_ch_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "client header for Root failed\n"));
BE_abort ();
}
+
+ ctx.state (TAO_CodeGen::TAO_ROOT_CH);
+ be_visitor_root_ch root_ch_visitor (&ctx);
+ BE_visit_root (root_ch_visitor, "client header");
// Initialize the anyop source stream, if the option is set.
// It has to be done after the stub header file generation,
// where checks for recursive types are done,
- // and before stub source file generation,
- // since #includes of Any-related files may be redirected to a
- // separate file.
- if (be_global->gen_anyop_files ())
+ // and before stub source file generation, since
+ // generation of Any-related #includes may be redirected.
+ fname = be_global->be_get_anyop_source_fname ();
+
+ if (-1 == tao_cg->start_anyop_source (fname))
{
- int status = 0;
-
- status =
- tao_cg->start_anyop_source (
- be_global->be_get_anyop_source_fname ()
- );
-
- if (status == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) TAO_CodeGen::"
- "TAO_CodeGen - "
- "Error opening anyop source file\n"));
- }
+ BE_abort ();
}
- // (3) Generate client inline and
- // set the context information.
if (be_global->gen_client_inline ())
{
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_CI);
-
- // Create a visitor.
be_visitor_root_ci root_ci_visitor (&ctx);
-
- // Generate code for the client inline file.
- if (root->accept (&root_ci_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "client inline for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (root_ci_visitor, "client inline");
}
- // (4) Generate client stubs.
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_CS);
-
- // Create a visitor.
be_visitor_root_cs root_cs_visitor (&ctx);
+ BE_visit_root (root_cs_visitor, "client stub");
- // Generate code for the client stubs.
- if (root->accept (&root_cs_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "client stubs for Root failed\n"));
- BE_abort ();
- }
-
- // (5) Generate server header.
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SH);
-
- // Create a visitor.
be_visitor_root_sh root_sh_visitor (&ctx);
-
- // Generate code for the server header file.
- if (root->accept (&root_sh_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "server header for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (root_sh_visitor, "server header");
// If skeleton file generation is suppressed, we're done.
if (!be_global->gen_skel_files ())
@@ -286,96 +185,36 @@ BE_produce (void)
if (be_global->gen_server_inline ())
{
- // (6) Generate server inline.
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SI);
-
- // Create a visitor.
be_visitor_root_si root_si_visitor (&ctx);
-
- // Generate code for the server inline file.
- if (root->accept (&root_si_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "server inline for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (root_si_visitor, "server inline");
}
- // (7) Generate server skeletons
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_SS);
-
- // Create a visitor.
be_visitor_root_ss root_ss_visitor (&ctx);
+ BE_visit_root (root_ss_visitor, "server skeleton");
- // Generate code for the server skeletons.
- if (root->accept (&root_ss_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "server skeletons for Root failed\n"));
- BE_abort ();
- }
-
- // (8) Generated server template header.
+ // Inline and source files for tie classes are generated
+ // by the corresponding skeleton visitors.
if (be_global->gen_tie_classes ())
{
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_TIE_SH);
-
- // Create a visitor.
be_visitor_root_sth sth_visitor (&ctx);
-
- // Generate code for the implementation header.
- if (root->accept (&sth_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "server template header for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (sth_visitor, "server template header");
}
- // Check if the flags are set for generating the
- // the implementation header and skeleton files.
if (be_global->gen_impl_files ())
{
- // (9) generate implementation header.
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_IH);
-
- // Create a visitor.
be_visitor_root_ih root_ih_visitor (&ctx);
+ BE_visit_root (root_ih_visitor, "implementation header");
- // Generate code for the implementation header.
- if (root->accept (&root_ih_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "implementation skeletons for Root failed\n"));
- BE_abort ();
- }
-
- // (10) Generate implementation source.
- ctx.reset ();
ctx.state (TAO_CodeGen::TAO_ROOT_IS);
-
- // Create a visitor.
be_visitor_root_is root_is_visitor (&ctx);
-
- // Generate code for the implementation source.
- if (root->accept (&root_is_visitor) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- "(%N:%l) be_produce - "
- "implementation skeletons for Root failed\n"));
- BE_abort ();
- }
+ BE_visit_root (root_is_visitor, "implementation skeleton");
}
- // Clean up.
+ // Done with this IDL file.
BE_cleanup ();
}
diff --git a/TAO/TAO_IDL/be/be_root.cpp b/TAO/TAO_IDL/be/be_root.cpp
index 824ff8565d3..7ccffd91e03 100644
--- a/TAO/TAO_IDL/be/be_root.cpp
+++ b/TAO/TAO_IDL/be/be_root.cpp
@@ -54,6 +54,10 @@ be_root::be_root (UTL_ScopedName *n)
{
}
+be_root::~be_root (void)
+{
+}
+
// We had to provide these since the AST_Root::fe_* method was setting the
// names of these three to "local type".
diff --git a/TAO/TAO_IDL/be/be_scope.cpp b/TAO/TAO_IDL/be/be_scope.cpp
index dd202eeab25..c335fee14c3 100644
--- a/TAO/TAO_IDL/be/be_scope.cpp
+++ b/TAO/TAO_IDL/be/be_scope.cpp
@@ -92,7 +92,6 @@ be_scope::decl (void)
void
be_scope::destroy (void)
{
- UTL_Scope::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp
index 6ba6f9af99d..abb99acceb5 100644
--- a/TAO/TAO_IDL/be/be_sequence.cpp
+++ b/TAO/TAO_IDL/be/be_sequence.cpp
@@ -201,11 +201,13 @@ be_sequence::gen_name (void)
UTL_Scope *parent = this->defined_in ();
seq->set_defined_in (parent);
parent->add_sequence (seq);
+ char *seq_name = seq->gen_name ();
ACE_OS::sprintf (namebuf,
"_tao_seq_%s_%s",
- seq->gen_name (),
+ seq_name,
fn ? fn->local_name ()->get_string () : "");
+ ACE::strdelete (seq_name);
}
else
{
@@ -225,7 +227,7 @@ be_sequence::gen_name (void)
ulval_str);
}
- return ACE_OS::strdup (namebuf);
+ return ACE::strnew (namebuf);
}
// Create a name for ourselves.
@@ -241,7 +243,9 @@ be_sequence::create_name (be_typedef *node)
// If there is a typedef node, we use its name as our name.
if (node)
{
- this->set_name (node->name ());
+ this->set_name (
+ dynamic_cast<UTL_ScopedName *> (node->name ()->copy ())
+ );
}
else
{
@@ -282,7 +286,7 @@ be_sequence::create_name (be_typedef *node)
return -1;
}
- ACE_OS::free (namebuf);
+ ACE::strdelete (namebuf);
}
return 0;
@@ -690,9 +694,6 @@ be_sequence::compute_tc_name (void)
ACE_NEW (tao_id,
Identifier ("TAO"));
-// ACE_NEW (tao_id,
-// Identifier (""));
-
ACE_NEW (this->tc_name_,
UTL_ScopedName (tao_id,
0));
@@ -749,8 +750,9 @@ void
be_sequence::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_type::destroy ();
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Sequence::destroy ();
}
// Narrowing
diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp
index 2b1bdf520b4..aaaf8427a7a 100644
--- a/TAO/TAO_IDL/be/be_string.cpp
+++ b/TAO/TAO_IDL/be/be_string.cpp
@@ -99,23 +99,13 @@ be_string::compute_tc_name (void)
ACE_NEW (tao_id,
Identifier ("TAO"));
- // ACE_NEW (tao_id,
- // Identifier (""));
-
ACE_NEW (this->tc_name_,
UTL_ScopedName (tao_id,
0));
-// char bound[30] = { 0 };
-
-// ACE_OS::sprintf (bound,
-// "_%lu",
-// this->max_size ()->ev ()->u.ulval);
-
ACE_CString local_tc_name =
ACE_CString ("tc_")
+ ACE_CString (this->flat_name ());
-// + ACE_CString (bound);
Identifier * typecode_scope = 0;
ACE_NEW (typecode_scope,
@@ -131,6 +121,8 @@ be_string::compute_tc_name (void)
ACE_NEW (id,
Identifier (local_tc_name.c_str ()));
}
+
+ zero.destroy ();
UTL_ScopedName *conc_name = 0;
ACE_NEW (conc_name,
diff --git a/TAO/TAO_IDL/be/be_structure.cpp b/TAO/TAO_IDL/be/be_structure.cpp
index dae08f4df58..d26a250cebf 100644
--- a/TAO/TAO_IDL/be/be_structure.cpp
+++ b/TAO/TAO_IDL/be/be_structure.cpp
@@ -86,9 +86,9 @@ void
be_structure::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_type::destroy ();
- AST_Decl::destroy ();
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Structure::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_structure_fwd.cpp b/TAO/TAO_IDL/be/be_structure_fwd.cpp
index 63d59761ba2..cfc33e9b28d 100644
--- a/TAO/TAO_IDL/be/be_structure_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_structure_fwd.cpp
@@ -57,7 +57,8 @@ be_structure_fwd::~be_structure_fwd (void)
void
be_structure_fwd::destroy (void)
{
- // Do nothing.
+ this->be_type::destroy ();
+ this->AST_StructureFwd::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
index 599e9018584..baba7a99f9f 100644
--- a/TAO/TAO_IDL/be/be_type.cpp
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -344,12 +344,8 @@ be_type::destroy (void)
delete this->tc_name_;
this->tc_name_ = 0;
}
-
- if (this->nested_type_name_ != 0)
- {
- delete [] this->nested_type_name_;
- this->nested_type_name_ = 0;
- }
+
+ this->be_decl::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp
index b5ce7cbd7d5..7d23e07703d 100644
--- a/TAO/TAO_IDL/be/be_union.cpp
+++ b/TAO/TAO_IDL/be/be_union.cpp
@@ -121,8 +121,10 @@ void
be_union::destroy (void)
{
// Call the destroy methods of our base classes.
- be_scope::destroy ();
- be_type::destroy ();
+ this->be_scope::destroy ();
+ this->be_type::destroy ();
+ this->AST_Union::destroy ();
+
}
// Visitor method.
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index 4c67346e028..22cd43f8a86 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -188,6 +188,13 @@ be_union_branch::accept (be_visitor *visitor)
return visitor->visit_union_branch (this);
}
+void
+be_union_branch::destroy (void)
+{
+ this->be_decl::destroy ();
+ this->AST_UnionBranch::destroy ();
+}
+
// Narrowing.
IMPL_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl)
IMPL_NARROW_FROM_DECL (be_union_branch)
diff --git a/TAO/TAO_IDL/be/be_union_fwd.cpp b/TAO/TAO_IDL/be/be_union_fwd.cpp
index cf612eecbb7..e695b8335e9 100644
--- a/TAO/TAO_IDL/be/be_union_fwd.cpp
+++ b/TAO/TAO_IDL/be/be_union_fwd.cpp
@@ -64,7 +64,7 @@ be_union_fwd::~be_union_fwd (void)
void
be_union_fwd::destroy (void)
{
- // Do nothing.
+ this->be_structure_fwd::destroy ();
}
int
diff --git a/TAO/TAO_IDL/be/be_union_label.cpp b/TAO/TAO_IDL/be/be_union_label.cpp
index 7c476be7745..2f1f63dc27b 100644
--- a/TAO/TAO_IDL/be/be_union_label.cpp
+++ b/TAO/TAO_IDL/be/be_union_label.cpp
@@ -26,3 +26,10 @@ be_union_label::accept (be_visitor *visitor)
{
return visitor->visit_union_label (this);
}
+
+void
+be_union_label::destroy (void)
+{
+ this->AST_UnionLabel::destroy ();
+}
+
diff --git a/TAO/TAO_IDL/be/be_valuetype.cpp b/TAO/TAO_IDL/be/be_valuetype.cpp
index dc168c5d8bc..6b81e89321f 100644
--- a/TAO/TAO_IDL/be/be_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_valuetype.cpp
@@ -133,7 +133,10 @@ be_valuetype::be_valuetype (UTL_ScopedName *n,
for (long i = 0; i < this->pd_n_supports; ++i)
{
- if (this->pd_supports[i]->is_abstract ())
+ be_interface *intf =
+ be_interface::narrow_from_decl (this->pd_supports[i]);
+
+ if (intf->has_mixed_parentage ())
{
this->supports_abstract_ = true;
break;
@@ -188,7 +191,7 @@ be_valuetype::compute_fullobvskelname (void)
const char*
be_valuetype::full_obv_skel_name (void)
{
- if (!this->full_obv_skel_name_)
+ if (0 == this->full_obv_skel_name_)
{
compute_fullobvskelname ();
}
@@ -610,7 +613,11 @@ be_valuetype::accept (be_visitor *visitor)
void
be_valuetype::destroy (void)
{
+ delete [] this->full_obv_skel_name_;
+ this->full_obv_skel_name_ = 0;
+
this->be_interface::destroy ();
+ this->AST_ValueType::destroy ();
}
ACE_CDR::ULong
diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
index 138ed412013..232bed31bea 100644
--- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp
@@ -23,7 +23,9 @@
#include "be_operation.h"
#include "be_predefined_type.h"
#include "be_argument.h"
+#include "be_extern.h"
#include "utl_identifier.h"
+#include "utl_exceptlist.h"
#include "global_extern.h"
#include "ace/Log_Msg.h"
@@ -299,7 +301,7 @@ be_visitor_amh_pre_proc::create_response_handler_attribute (
be_valuetype *exception_holder
)
{
- // Temporerily generate the get operation.
+ // Temporarily generate the get operation.
be_operation *get_operation = this->generate_get_operation (node);
this->visit_operation (get_operation);
@@ -312,19 +314,28 @@ be_visitor_amh_pre_proc::create_response_handler_attribute (
be_operation_strategy *get_operation_strategy =
get_operation->set_strategy (default_strategy);
- if (get_operation_strategy)
+ if (0 != get_operation_strategy)
{
be_operation_strategy *gos =
node->set_get_strategy (get_operation_strategy);
- delete gos;
- gos = 0;
+
+ if (0 != gos)
+ {
+ gos->destroy ();
+ delete gos;
+ gos = 0;
+ }
}
int status =
this->create_response_handler_operation (get_operation,
response_handler,
exception_holder);
-
+
+ get_operation->destroy ();
+ delete get_operation;
+ get_operation = 0;
+
if (status == -1)
{
return -1;
@@ -349,25 +360,29 @@ be_visitor_amh_pre_proc::create_response_handler_attribute (
set_operation->set_strategy (default_strategy);
// Assign it to the attribute as set_operation strategy.
- if (set_operation_strategy)
+ if (0 != set_operation_strategy)
{
be_operation_strategy *sos =
node->set_set_strategy (set_operation_strategy);
- delete sos;
- sos = 0;
+
+ if (0 != sos)
+ {
+ sos->destroy ();
+ delete sos;
+ sos = 0;
+ }
}
status =
this->create_response_handler_operation (set_operation,
response_handler,
exception_holder);
-
- if (status == -1)
- {
- return -1;
- }
-
- return 0;
+
+ set_operation->destroy ();
+ delete set_operation;
+ set_operation = 0;
+
+ return status;
}
int
@@ -375,54 +390,38 @@ be_visitor_amh_pre_proc::add_exception_reply (be_operation *node,
be_interface *response_handler,
be_valuetype *exception_holder)
{
- Identifier *id = 0;
- UTL_ScopedName *sn = 0;
-
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- -1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- -1);
-
- // Create the return type, which is "void"
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- -1);
-
- // Create the name...
UTL_ScopedName *operation_name = node->compute_name ("",
"_excep");
be_operation *node_excep = 0;
ACE_NEW_RETURN (node_excep,
- be_operation (rt,
+ be_operation (be_global->void_type (),
AST_Operation::OP_noflags,
operation_name,
1,
0),
-1);
+
+ node_excep->set_name (operation_name);
- ACE_NEW_RETURN (id,
+ Identifier *arg_id = 0;
+ ACE_NEW_RETURN (arg_id,
Identifier ("holder"),
-1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
+
+ UTL_ScopedName *arg_name = 0;
+ ACE_NEW_RETURN (arg_name,
+ UTL_ScopedName (arg_id, 0),
-1);
be_argument *argument = 0;
ACE_NEW_RETURN (argument,
be_argument (AST_Argument::dir_IN,
exception_holder,
- sn),
+ arg_name),
-1);
+ argument->set_name (arg_name);
argument->set_defined_in (node_excep);
node_excep->be_add_argument (argument);
@@ -443,22 +442,6 @@ be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
Identifier *id = 0;
UTL_ScopedName *sn = 0;
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- -1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- -1);
-
- // Create the return type, which is "void"
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- -1);
-
ACE_CString original_op_name (
node->name ()->last_component ()->get_string ()
);
@@ -467,7 +450,7 @@ be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
static_cast<UTL_ScopedName *> (response_handler->name ()->copy ());
ACE_NEW_RETURN (id,
- Identifier (original_op_name.rep ()),
+ Identifier (original_op_name.c_str ()),
-1);
ACE_NEW_RETURN (sn,
@@ -480,7 +463,7 @@ be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
// Create the operation
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
- be_operation (rt,
+ be_operation (be_global->void_type (),
AST_Operation::OP_noflags,
op_name,
1,
@@ -493,22 +476,26 @@ be_visitor_amh_pre_proc::add_normal_reply (be_operation *node,
if (!node->void_return_type ())
{
- ACE_NEW_RETURN (id,
+ Identifier *arg_id = 0;
+ ACE_NEW_RETURN (arg_id,
Identifier ("return_value"),
-1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
+
+ UTL_ScopedName *arg_name = 0;
+ ACE_NEW_RETURN (arg_name,
+ UTL_ScopedName (arg_id, 0),
-1);
+
// Create the argument
be_argument *arg = 0;
ACE_NEW_RETURN (arg,
be_argument (AST_Argument::dir_IN,
node->return_type (),
- sn),
+ arg_name),
-1);
-
+
+ arg->set_name (arg_name);
+
// Add the response handler to the argument list
operation->be_add_argument (arg);
}
@@ -586,6 +573,7 @@ be_visitor_amh_pre_proc::visit_operation (be_operation *node)
if (old_strategy)
{
+ old_strategy->destroy ();
delete old_strategy;
old_strategy = 0;
}
@@ -706,23 +694,6 @@ be_visitor_amh_pre_proc::create_raise_operation (
orig_op = be_operation::narrow_from_decl (node);
}
- // Create the return type, which is "void"
-
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- -1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- -1);
-
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- -1);
-
// Name the operation properly
UTL_ScopedName *op_name =
static_cast<UTL_ScopedName *> (excep_holder->name ()->copy ());
@@ -741,7 +712,7 @@ be_visitor_amh_pre_proc::create_raise_operation (
new_local_name += node->name ()->last_component ()->get_string ();
ACE_NEW_RETURN (id,
- Identifier (new_local_name.rep ()),
+ Identifier (new_local_name.c_str ()),
-1);
ACE_NEW_RETURN (sn,
@@ -753,7 +724,7 @@ be_visitor_amh_pre_proc::create_raise_operation (
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
- be_operation (rt,
+ be_operation (be_global->void_type (),
AST_Operation::OP_noflags,
op_name,
0,
@@ -768,10 +739,11 @@ be_visitor_amh_pre_proc::create_raise_operation (
if (orig_op)
{
// Copy the exceptions.
- if (orig_op->exceptions ())
+ UTL_ExceptList *exceptions = orig_op->exceptions ();
+
+ if (0 != exceptions)
{
- UTL_ExceptList *exceptions = orig_op->exceptions ();
- operation->be_add_exceptions (exceptions);
+ operation->be_add_exceptions (exceptions->copy ());
}
}
}
@@ -789,6 +761,7 @@ be_visitor_amh_pre_proc::create_raise_operation (
if (old_strategy)
{
+ old_strategy->destroy ();
delete old_strategy;
old_strategy = 0;
}
@@ -821,15 +794,14 @@ be_visitor_amh_pre_proc::generate_name (ACE_CString &destination,
be_operation *
be_visitor_amh_pre_proc::generate_get_operation (be_attribute *node)
{
- ACE_CString original_op_name (node
- ->name ()
- ->last_component ()
- ->get_string ());
+ ACE_CString original_op_name (
+ node->name ()->last_component ()->get_string ()
+ );
ACE_CString new_op_name = ACE_CString ("get_") + original_op_name;
UTL_ScopedName *get_name =
static_cast<UTL_ScopedName *> (node->name ()-> copy ());
- get_name->last_component ()->replace_string (new_op_name.rep ());
+ get_name->last_component ()->replace_string (new_op_name.c_str ());
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
@@ -854,50 +826,31 @@ be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node)
);
ACE_CString new_op_name = ACE_CString ("set_") + original_op_name;
- UTL_ScopedName *set_name =
- static_cast<UTL_ScopedName *> (node->name ()-> copy ());
- set_name->last_component ()->replace_string (new_op_name.rep ());
-
- Identifier *id = 0;
- UTL_ScopedName *sn = 0;
-
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- 0);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- // The return type is "void".
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- 0);
+ UTL_ScopedName *set_op_name =
+ dynamic_cast<UTL_ScopedName *> (node->name ()-> copy ());
+ set_op_name->last_component ()->replace_string (new_op_name.c_str ());
// argument type is the same as the attribute type
be_argument *arg = 0;
ACE_NEW_RETURN (arg,
be_argument (AST_Argument::dir_IN,
node->field_type (),
- set_name),
+ set_op_name),
0);
- arg->set_name (node->name ());
+ arg->set_name (dynamic_cast<UTL_ScopedName *> (node->name ()->copy ()));
// create the operation
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
- be_operation (rt,
+ be_operation (be_global->void_type (),
AST_Operation::OP_noflags,
- set_name,
+ set_op_name,
0,
0),
0);
- operation->set_name (set_name);
+ operation->set_name (set_op_name);
operation->set_defined_in (node->defined_in ());
operation->be_add_argument (arg);
diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
index c656e056e55..80126e4c756 100644
--- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp
@@ -37,6 +37,7 @@
#include "be_global.h"
#include "be_extern.h"
#include "utl_identifier.h"
+#include "utl_exceptlist.h"
#include "nr_extern.h"
#include "global_extern.h"
#include "ace/Log_Msg.h"
@@ -75,6 +76,13 @@ be_visitor_ami_pre_proc::visit_root (be_root *node)
int
be_visitor_ami_pre_proc::visit_module (be_module *node)
{
+ // Skip this for now until we get AMI integrated with
+ // CIAO.
+ if (0 == ACE_OS::strcmp (node->local_name ()->get_string (), "Components"))
+ {
+ return 0;
+ }
+
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -95,6 +103,42 @@ be_visitor_ami_pre_proc::visit_interface (be_interface *node)
{
return 0;
}
+
+ // The following 3 IF blocks are checks for CCM-related nodes, which
+ // we want to skip until we get AMI integrated with CIAO.
+
+ // Skip the *EventConsumer added for each eventtype.
+ if (node->is_event_consumer ())
+ {
+ return 0;
+ }
+
+ // Check for home equivalent interface. The lookup will find the
+ // home itself, which was declared first.
+ Identifier *node_lname = node->AST_Decl::local_name ();
+ AST_Decl *first_stored =
+ node->defined_in ()->lookup_by_name_local (node_lname, 0);
+
+ if (0 != first_stored && first_stored->node_type () == AST_Decl::NT_home)
+ {
+ return 0;
+ }
+
+ ACE_CString lname (node_lname->get_string ());
+
+ // Skip the *Explict and *Implicit interfaces added for a home.
+ if (lname.substr (lname.length () - 6) == "plicit")
+ {
+ UTL_Scope *s = node->defined_in ();
+ Identifier local_id (lname.substr (0, lname.length () - 8).c_str ());
+ AST_Decl *d = s->lookup_by_name_local (&local_id, 0);
+ local_id.destroy ();
+
+ if (0 != d)
+ {
+ return 0;
+ }
+ }
AST_Module *module =
AST_Module::narrow_from_scope (node->defined_in ());
@@ -149,53 +193,11 @@ be_visitor_ami_pre_proc::visit_interface (be_interface *node)
if (old_strategy)
{
+ old_strategy->destroy ();
delete old_strategy;
old_strategy = 0;
}
-
- // Only do this when we have created a new exceptionholder. In the old
- // AMI setup the global_excep_holder is always 0, in the new setup it
- // is only 0 in the first case.
- if (excep_holder && !global_excep_holder)
- {
- excep_holder->set_defined_in (node->defined_in ());
- // Insert the exception holder after the original node,
- // this way we ensure that it is *before* the
- // ami handler, which is the way we want to have it.
- module->be_add_interface (excep_holder, node);
- module->set_has_nested_valuetype ();
- // Remember from whom we were cloned.
- excep_holder->original_interface (node);
-
- // Set the strategy.
- be_interface_ami_exception_holder_strategy *biaehs = 0;
- ACE_NEW_RETURN (biaehs,
- be_interface_ami_exception_holder_strategy (
- excep_holder
- ),
- -1);
-
- be_interface_strategy *old_strategy =
- excep_holder->set_strategy (biaehs);
-
- if (old_strategy)
- {
- delete old_strategy;
- old_strategy = 0;
- }
- }
- else
- {
- if (!excep_holder)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_ami_pre_proc::"
- "visit_interface - "
- "creating the exception holder failed\n"),
- -1);
- }
- }
-
+
if (this->visit_scope (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -216,6 +218,10 @@ be_visitor_ami_pre_proc::visit_operation (be_operation *node)
// We do nothing for oneways!
return 0;
}
+
+ // If we're here, we're sure that the arg traits specialization
+ // for this will be needed.
+ be_global->messaging_exceptionholder ()->seen_in_operation (true);
be_operation *sendc_marshaling =
this->create_sendc_operation (node,
@@ -225,7 +231,7 @@ be_visitor_ami_pre_proc::visit_operation (be_operation *node)
this->create_sendc_operation (node,
1); // for arguments = TRUE
- if (sendc_marshaling && sendc_arguments)
+ if (0 != sendc_marshaling && 0 != sendc_arguments)
{
sendc_marshaling->set_defined_in (node->defined_in ());
@@ -247,6 +253,7 @@ be_visitor_ami_pre_proc::visit_operation (be_operation *node)
if (old_strategy)
{
+ old_strategy->destroy ();
delete old_strategy;
old_strategy = 0;
}
@@ -272,14 +279,23 @@ be_visitor_ami_pre_proc::visit_attribute (be_attribute *node)
be_operation_strategy *set_operation_strategy =
set_operation->set_strategy (bods);
+
+ set_operation->destroy ();
+ delete set_operation;
+ set_operation = 0;
// Assign it to the attribute as set_operation strategy.
- if (set_operation_strategy)
+ if (0 != set_operation_strategy)
{
be_operation_strategy *bos =
node->set_set_strategy (set_operation_strategy);
- delete bos;
- bos = 0;
+
+ if (0 != bos)
+ {
+ bos->destroy ();
+ delete bos;
+ bos = 0;
+ }
}
// Temporerily generate the get operation.
@@ -288,19 +304,30 @@ be_visitor_ami_pre_proc::visit_attribute (be_attribute *node)
this->visit_operation (get_operation);
+ // Retrieve the strategy set by the visit operation.
ACE_NEW_RETURN (bods,
be_operation_default_strategy (get_operation),
-1);
be_operation_strategy *get_operation_strategy =
get_operation->set_strategy (bods);
+
+ get_operation->destroy ();
+ delete get_operation;
+ get_operation = 0;
- if (get_operation_strategy)
+ // Assign it to the attribute as get_operation strategy.
+ if (0 != get_operation_strategy)
{
be_operation_strategy *bos =
node->set_get_strategy (get_operation_strategy);
- delete bos;
- bos = 0;
+
+ if (0 != bos)
+ {
+ bos->destroy ();
+ delete bos;
+ bos = 0;
+ }
}
return 0;
@@ -309,120 +336,7 @@ be_visitor_ami_pre_proc::visit_attribute (be_attribute *node)
be_valuetype *
be_visitor_ami_pre_proc::create_exception_holder (be_interface *node)
{
- be_valuetype *global = be_global->exceptionholder ();
- if (global != 0)
- {
- return global;
- }
-
- Identifier *id = 0;
- UTL_ScopedName *sn = 0;
-
- ACE_NEW_RETURN (id,
- Identifier ("Messaging"),
- 0);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- be_module *msg = 0;
- ACE_NEW_RETURN (msg,
- be_module (sn),
- 0);
-
- idl_global->scopes ().push (msg);
-
- ACE_NEW_RETURN (id,
- Identifier ("Messaging"),
- 0);
-
- // Create a virtual module named "Messaging" and an valuetype "ExceptionHolder"
- // from which we inherit.
- UTL_ScopedName *inherit_name = 0;
- ACE_NEW_RETURN (inherit_name,
- UTL_ScopedName (id,
- 0),
- 0);
-
- ACE_NEW_RETURN (id,
- Identifier ("ExceptionHolder"),
- 0);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- inherit_name->nconc (sn);
-
- be_valuetype *inherit_vt = 0;
- ACE_NEW_RETURN (inherit_vt,
- be_valuetype (inherit_name,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0),
- 0);
-
- inherit_vt->set_name (inherit_name);
- inherit_vt->seen_in_operation (true);
-
- // Notice the valuetype "ExceptionHolder" that it is defined in the
- // "Messaging" module
- inherit_vt->set_defined_in (msg);
- inherit_vt->set_prefix_with_typeprefix ("omg.org");
-
- // Create the exception holder name
- ACE_CString excep_holder_local_name;
- excep_holder_local_name = "ExceptionHolder";
-
- UTL_ScopedName *excep_holder_name = 0;
- excep_holder_name =
- static_cast<UTL_ScopedName *> (node->name ()->copy ());
- excep_holder_name->last_component ()->replace_string (
- excep_holder_local_name.rep ()
- );
-
- AST_Interface_ptr *p_intf = 0;
- ACE_NEW_RETURN (p_intf,
- AST_Interface_ptr[1],
- 0);
-
- p_intf[0] = inherit_vt;
-
- be_valuetype *excep_holder = 0;
- ACE_NEW_RETURN (excep_holder,
- be_valuetype (excep_holder_name,
- p_intf,
- 1,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0),
- 0);
-
- idl_global->scopes ().pop ();
- excep_holder->seen_in_operation (true);
- excep_holder->cli_hdr_gen (true);
- excep_holder->set_imported (true);
-
- be_global->exceptionholder (excep_holder);
-
- return excep_holder;
+ return be_global->messaging_exceptionholder ();
}
be_interface *
@@ -445,11 +359,11 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
UTL_ScopedName *reply_handler_name =
static_cast<UTL_ScopedName *> (node->name ()->copy ());
reply_handler_name->last_component ()->replace_string (
- reply_handler_local_name.rep ()
+ reply_handler_local_name.c_str ()
);
long n_parents = 0;
- AST_Interface_ptr *p_intf = this->create_inheritance_list (node, n_parents);
+ AST_Interface **p_intf = this->create_inheritance_list (node, n_parents);
be_interface *reply_handler = 0;
ACE_NEW_RETURN (reply_handler,
@@ -507,23 +421,33 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node,
be_operation *get_operation =
this->generate_get_operation (attribute);
+
this->create_reply_handler_operation (get_operation,
reply_handler);
this->create_excep_operation (get_operation,
reply_handler,
excep_holder);
+
+ get_operation->destroy ();
+ delete get_operation;
+ get_operation = 0;
if (!attribute->readonly ())
{
be_operation *set_operation =
this->generate_set_operation (attribute);
+
this->create_reply_handler_operation (set_operation,
reply_handler);
this->create_excep_operation (set_operation,
reply_handler,
excep_holder);
+
+ set_operation->destroy ();
+ delete set_operation;
+ set_operation = 0;
}
}
else
@@ -606,7 +530,7 @@ be_visitor_ami_pre_proc::create_raise_operation (
new_local_name += node->name ()->last_component ()->get_string ();
ACE_NEW_RETURN (id,
- Identifier (new_local_name.rep ()),
+ Identifier (new_local_name.c_str ()),
-1);
ACE_NEW_RETURN (sn,
@@ -634,10 +558,11 @@ be_visitor_ami_pre_proc::create_raise_operation (
if (orig_op)
{
// Copy the exceptions.
- if (orig_op->exceptions ())
+ UTL_ExceptList *exceptions = orig_op->exceptions ();
+
+ if (0 != exceptions)
{
- UTL_ExceptList *exceptions = orig_op->exceptions ();
- operation->be_add_exceptions (exceptions);
+ operation->be_add_exceptions (exceptions->copy ());
}
}
}
@@ -653,6 +578,7 @@ be_visitor_ami_pre_proc::create_raise_operation (
if (old_strategy)
{
+ old_strategy->destroy ();
delete old_strategy;
old_strategy = 0;
}
@@ -680,23 +606,6 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
Identifier *id = 0;
UTL_ScopedName *sn = 0;
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- 0);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- // Create the return type, which is "void"
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (
- AST_PredefinedType::PT_void,
- sn),
- 0);
-
// Create the new name
// Prepend "sendc_" to the name of the operation
ACE_CString original_op_name (
@@ -706,50 +615,56 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
UTL_ScopedName *op_name =
static_cast<UTL_ScopedName *> (node->name ()->copy ());
- op_name->last_component ()->replace_string (new_op_name.rep ());
+ op_name->last_component ()->replace_string (new_op_name.c_str ());
// Create the operation
be_operation *op = 0;
ACE_NEW_RETURN (op,
- be_operation (rt,
+ be_operation (be_global->void_type (),
AST_Operation::OP_noflags,
op_name,
0,
0),
0);
+
+ op->set_name (op_name);
// Create the first argument, which is a Reply Handler
if (for_arguments)
{
- // Create the field type
- be_decl *parent =
- be_scope::narrow_from_scope (node->defined_in ())->decl ();
+ // Look up the field type.
+ UTL_Scope *s = node->defined_in ();
+ be_decl *parent = be_scope::narrow_from_scope (s)->decl ();
// Add the pre- and suffix
- ACE_CString excep_holder_name;
- this->generate_name (excep_holder_name,
+ ACE_CString handler_local_name;
+ this->generate_name (handler_local_name,
"AMI_",
parent->name ()->last_component ()->get_string (),
"Handler");
UTL_ScopedName *field_name =
static_cast<UTL_ScopedName *> (parent->name ()->copy ());
- field_name->last_component ()->replace_string (excep_holder_name.rep ());
-
- be_interface *field_type = 0;
- ACE_NEW_RETURN (field_type,
- be_interface (field_name,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0),
- 0);
-
- field_type->set_defined_in (node->defined_in ());
- field_type->set_name (field_name);
+ field_name->last_component ()->replace_string (
+ handler_local_name.c_str ()
+ );
+
+ AST_Decl *d = s->lookup_by_name (field_name, true);
+ field_name->destroy ();
+ delete field_name;
+ field_name = 0;
+
+ if (0 == d)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_ami_pre_proc::"
+ "create_sendc_operation - "
+ "lookup of reply handler failed\n"),
+ 0);
+ }
+
+ be_interface *field_type = be_interface::narrow_from_decl (d);
// Create the argument.
ACE_NEW_RETURN (id,
@@ -776,6 +691,11 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node,
arg->set_defined_in (op);
arg->set_name (sn);
op->be_add_argument (arg);
+
+ if (field_type->imported ())
+ {
+ field_type->seen_in_operation (false);
+ }
}
// Iterate over the arguments and put all the in and inout
@@ -846,22 +766,6 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (
Identifier *id = 0;
UTL_ScopedName *sn = 0;
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- -1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- -1);
-
- // Create the return type, which is "void"
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- -1);
-
ACE_CString original_op_name (
node->name ()->last_component ()->get_string ()
);
@@ -870,7 +774,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (
static_cast<UTL_ScopedName *> (reply_handler->name ()-> copy ());
ACE_NEW_RETURN (id,
- Identifier (original_op_name.rep ()),
+ Identifier (original_op_name.c_str ()),
-1);
ACE_NEW_RETURN (sn,
@@ -883,7 +787,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (
// Create the operation.
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
- be_operation (rt,
+ be_operation (be_global->void_type (),
AST_Operation::OP_noflags,
op_name,
0,
@@ -978,6 +882,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (
if (old_strategy)
{
+ old_strategy->destroy ();
delete old_strategy;
old_strategy = 0;
}
@@ -989,7 +894,11 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (
if (node->exceptions ())
{
UTL_ExceptList *exceptions = node->exceptions ();
- operation->be_add_exceptions (exceptions);
+
+ if (0 != exceptions)
+ {
+ operation->be_add_exceptions (exceptions->copy ());
+ }
}
#endif
@@ -1023,21 +932,6 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
Identifier *id = 0;
UTL_ScopedName *sn = 0;
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- -1);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- -1);
-
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- -1);
-
// Create the argument.
ACE_NEW_RETURN (id,
Identifier ("excep_holder"),
@@ -1055,6 +949,8 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
sn),
-1);
+ arg->set_name (sn);
+
UTL_ScopedName *tmp = (UTL_ScopedName *)sn->copy ();
// Create the new name
@@ -1068,7 +964,7 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
static_cast<UTL_ScopedName *> (reply_handler->name ()->copy ());
ACE_NEW_RETURN (id,
- Identifier (new_op_name.rep ()),
+ Identifier (new_op_name.c_str ()),
-1);
ACE_NEW_RETURN (sn,
@@ -1078,6 +974,8 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node,
op_name->nconc (sn);
+ AST_PredefinedType *rt = be_global->void_type ();
+
// Create the operation.
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
@@ -1219,7 +1117,7 @@ be_visitor_ami_pre_proc::generate_get_operation (be_attribute *node)
UTL_ScopedName *get_name =
static_cast<UTL_ScopedName *> (node->name ()->copy ());
- get_name->last_component ()->replace_string (new_op_name.rep ());
+ get_name->last_component ()->replace_string (new_op_name.c_str ());
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
@@ -1246,26 +1144,7 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node)
UTL_ScopedName *set_name =
static_cast<UTL_ScopedName *> (node->name ()-> copy ());
- set_name->last_component ()->replace_string (new_op_name.rep ());
-
- // The return type is "void".
- Identifier *id = 0;
- UTL_ScopedName *sn = 0;
-
- ACE_NEW_RETURN (id,
- Identifier ("void"),
- 0);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- be_predefined_type *rt = 0;
- ACE_NEW_RETURN (rt,
- be_predefined_type (AST_PredefinedType::PT_void,
- sn),
- 0);
+ set_name->last_component ()->replace_string (new_op_name.c_str ());
// Argument type is the same as the attribute type.
be_argument *arg = 0;
@@ -1275,12 +1154,12 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node)
set_name),
0);
- arg->set_name (node->name ());
+ arg->set_name ((UTL_ScopedName *) node->name ()->copy ());
// Create the operation.
be_operation *operation = 0;
ACE_NEW_RETURN (operation,
- be_operation (rt,
+ be_operation (be_global->void_type (),
AST_Operation::OP_noflags,
set_name,
0,
@@ -1294,11 +1173,11 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node)
return operation;
}
-be_visitor_ami_pre_proc::AST_Interface_ptr *
+AST_Interface **
be_visitor_ami_pre_proc::create_inheritance_list (be_interface *node,
long &n_rh_parents)
{
- AST_Interface_ptr *retval = 0;
+ AST_Interface **retval = 0;
long n_parents = node->n_inherits ();
AST_Interface **parents = node->inherits ();
@@ -1320,67 +1199,10 @@ be_visitor_ami_pre_proc::create_inheritance_list (be_interface *node,
if (n_rh_parents == 0)
{
- ACE_NEW_RETURN (id,
- Identifier ("Messaging"),
- 0);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- be_module *msg = 0;
- ACE_NEW_RETURN (msg,
- be_module (sn),
- 0);
-
- idl_global->scopes ().push (msg);
-
- // Create a virtual module named "Messaging" and an interface "ReplyHandler"
- // from which we inherit.
- ACE_NEW_RETURN (id,
- Identifier ("Messaging"),
- 0);
-
- UTL_ScopedName *inherit_name = 0;
- ACE_NEW_RETURN (inherit_name,
- UTL_ScopedName (id,
- 0),
- 0);
-
- ACE_NEW_RETURN (id,
- Identifier ("ReplyHandler"),
- 0);
-
- ACE_NEW_RETURN (sn,
- UTL_ScopedName (id,
- 0),
- 0);
-
- inherit_name->nconc (sn);
-
- be_interface *inherit_intf = 0;
- ACE_NEW_RETURN (inherit_intf,
- be_interface (inherit_name,
- 0, // inherited interfaces
- 0, // number of inherited interfaces
- 0, // ancestors
- 0, // number of ancestors
- 0, // not local
- 0), // not abstract
- 0);
-
- inherit_intf->set_name (inherit_name);
- inherit_intf->set_prefix_with_typeprefix ("omg.org");
-
- idl_global->scopes ().pop ();
-
- // Notice the interface "ReplyHandler" that it is defined in the
- // "Messaging" module.
- inherit_intf->set_defined_in (msg);
-
+ be_interface *inherit_intf = be_global->messaging_replyhandler ();
+
ACE_NEW_RETURN (retval,
- AST_Interface_ptr[1],
+ AST_Interface *[1],
0);
retval[0] = inherit_intf;
@@ -1389,7 +1211,7 @@ be_visitor_ami_pre_proc::create_inheritance_list (be_interface *node,
else
{
ACE_NEW_RETURN (retval,
- AST_Interface_ptr[n_rh_parents],
+ AST_Interface *[n_rh_parents],
0);
ACE_CString prefix ("AMI_");
@@ -1412,12 +1234,12 @@ be_visitor_ami_pre_proc::create_inheritance_list (be_interface *node,
static_cast<UTL_ScopedName *> (parent->name ()->copy ());
rh_parent_name->last_component ()->replace_string (
- rh_local_name.fast_rep ()
+ rh_local_name.c_str ()
);
AST_Decl *d =
node->defined_in ()->lookup_by_name (rh_parent_name,
- 1);
+ true);
if (d != 0)
{
@@ -1425,6 +1247,8 @@ be_visitor_ami_pre_proc::create_inheritance_list (be_interface *node,
}
rh_parent_name->destroy ();
+ delete rh_parent_name;
+ rh_parent_name = 0;
}
// Just a sanity check until we're sure this works in all use cases.
diff --git a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
index d7936cbd2ed..0865739e81a 100644
--- a/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_arg_traits.cpp
@@ -76,6 +76,21 @@ be_visitor_arg_traits::visit_root (be_root *node)
<< "// Arg traits specializations." << be_nl
<< "namespace TAO" << be_nl
<< "{" << be_idt;
+
+ if (be_global->ami_call_back ())
+ {
+ int status =
+ this->visit_valuetype (be_global->messaging_exceptionholder ());
+
+ if (-1 == status)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_arg_traits::"
+ "visit_root - visit "
+ "Messaging::ExceptionHolder failed\n"),
+ -1);
+ }
+ }
if (this->visit_scope (node) == -1)
{
@@ -143,7 +158,7 @@ be_visitor_arg_traits::visit_interface (be_interface *node)
if (ACE_OS::strlen (this->S_) == 0)
{
*os << "," << be_nl
- << "TAO::Objref_Traits<" << node->name () << ">";
+ << "TAO::Objref_Traits<" << node->name () << ">";
}
*os << "," << be_nl << this->insert_policy() << " <"
@@ -170,6 +185,9 @@ be_visitor_arg_traits::visit_interface (be_interface *node)
int
be_visitor_arg_traits::visit_interface_fwd (be_interface_fwd *node)
{
+ // If a full definition with the same name in the same scope
+ // has been seen, then it will have gone through visit_interface()
+ // already.
if (this->generated (node))
{
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
index 16fc6f39917..2e0ff1dc96c 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute.cpp
@@ -22,11 +22,15 @@
#include "be_operation.h"
#include "be_predefined_type.h"
#include "be_argument.h"
-#include "utl_identifier.h"
#include "be_visitor_attribute.h"
#include "be_visitor_context.h"
#include "be_visitor_operation.h"
+
+#include "ast_generator.h"
+#include "utl_identifier.h"
+#include "utl_exceptlist.h"
+#include "global_extern.h"
#include "ace/Log_Msg.h"
#include "be_visitor_attribute/attribute.cpp"
diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
index 4fbecfae674..93bcd6f9c2e 100644
--- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp
@@ -73,11 +73,25 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
get_op.set_name ((UTL_IdList *) node->name ()->copy ());
get_op.set_defined_in (node->defined_in ());
- get_op.be_add_exceptions (node->get_get_exceptions ());
+
+ UTL_ExceptList *get_exceptions = node->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ get_op.be_add_exceptions (get_exceptions->copy ());
+ }
// Get the strategy from the attribute and hand it over
// to the operation.
- delete get_op.set_strategy (node->get_get_strategy ());
+ be_operation_strategy *old_strategy =
+ get_op.set_strategy (node->get_get_strategy ()->copy ());
+
+ if (0 != old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
be_visitor_context ctx (*this->ctx_);
int status = 1;
@@ -153,11 +167,13 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
break;
}
default:
+ get_op.destroy ();
return 0;
}
if (status == -1)
{
+ get_op.destroy ();
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -174,6 +190,8 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
if (!visitor || (get_op.accept (visitor) == -1))
{
delete visitor;
+ visitor = 0;
+ get_op.destroy ();
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -193,6 +211,8 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
if (!visitor || (get_op.accept (visitor) == -1))
{
delete visitor;
+ visitor = 0;
+ get_op.destroy ();
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -204,6 +224,8 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
visitor = 0;
}
}
+
+ get_op.destroy ();
// Do nothing for readonly attributes.
if (node->readonly ())
@@ -221,11 +243,14 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
// The return type is "void".
be_predefined_type rt (AST_PredefinedType::PT_void,
&sn);
+
// Argument type is the same as the attribute type.
- be_argument arg (AST_Argument::dir_IN,
- node->field_type (),
- node->name ());
- arg.set_name ((UTL_IdList *) node->name ()->copy ());
+ AST_Argument *arg =
+ idl_global->gen ()->create_argument (AST_Argument::dir_IN,
+ node->field_type (),
+ node->name ());
+
+ arg->set_name ((UTL_IdList *) node->name ()->copy ());
// Create the operation.
be_operation set_op (&rt,
AST_Operation::OP_noflags,
@@ -234,12 +259,26 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
node->is_abstract ());
set_op.set_name ((UTL_IdList *) node->name ()->copy ());
set_op.set_defined_in (node->defined_in ());
- set_op.be_add_argument (&arg);
- set_op.be_add_exceptions (node->get_set_exceptions ());
+ set_op.be_add_argument (arg);
+
+ UTL_ExceptList *set_exceptions = node->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ set_op.be_add_exceptions (set_exceptions->copy ());
+ }
// Get the strategy from the attribute and hand it over
// to the operation, thereby deleting the old one.
- delete set_op.set_strategy (node->get_set_strategy ());
+ old_strategy =
+ set_op.set_strategy (node->get_set_strategy ()->copy ());
+
+ if (0 != old_strategy)
+ {
+ old_strategy->destroy ();
+ delete old_strategy;
+ old_strategy = 0;
+ }
ctx = *this->ctx_;
status = 1;
@@ -316,6 +355,8 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
}
default:
// Error.
+ set_op.destroy ();
+ rt.destroy ();
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -325,10 +366,14 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
if (status == 0)
{
+ set_op.destroy ();
+ rt.destroy ();
return 0;
}
else if (status == -1)
{
+ set_op.destroy ();
+ rt.destroy ();
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -343,6 +388,9 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
if (!visitor || (set_op.accept (visitor) == -1))
{
delete visitor;
+ visitor = 0;
+ set_op.destroy ();
+ rt.destroy ();
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -363,6 +411,9 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
if (!visitor || (set_op.accept (visitor) == -1))
{
delete visitor;
+ visitor = 0;
+ set_op.destroy ();
+ rt.destroy ();
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_attribute::"
"visit_attribute - "
@@ -373,6 +424,8 @@ be_visitor_attribute::visit_attribute (be_attribute *node)
delete visitor;
visitor = 0;
}
-
+
+ set_op.destroy ();
+ rt.destroy ();
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
index 2df3027db28..a1268a29bec 100644
--- a/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_ccm_pre_proc.cpp
@@ -108,15 +108,6 @@ be_visitor_ccm_pre_proc::visit_module (be_module *node)
int
be_visitor_ccm_pre_proc::visit_component (be_component *node)
{
- if (this->lookup_ccmobject () == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_ccm_pre_proc::"
- "visit_component - "
- "Components::CCMObject lookup failed\n"),
- -1);
- }
-
if (this->lookup_cookie (node) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
@@ -312,6 +303,12 @@ be_visitor_ccm_pre_proc::gen_provides (be_component *node)
{
return -1;
}
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
}
return 0;
@@ -387,6 +384,12 @@ be_visitor_ccm_pre_proc::gen_uses (be_component *node)
-1);
}
}
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
}
return 0;
@@ -421,6 +424,12 @@ be_visitor_ccm_pre_proc::gen_emits (be_component *node)
"gen_emits_disconnect failed\n"),
-1);
}
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
}
return 0;
@@ -455,6 +464,12 @@ be_visitor_ccm_pre_proc::gen_publishes (be_component *node)
"gen_unsubscribe failed\n"),
-1);
}
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
}
return 0;
@@ -480,6 +495,12 @@ be_visitor_ccm_pre_proc::gen_consumes (be_component *node)
"gen_consumes_get_connection failed\n"),
-1);
}
+
+ // Might as well clean up here instead of putting 5 loops in
+ // AST_Component::destroy ().
+ pd->id->destroy ();
+ delete pd->id;
+ pd->id = 0;
}
return 0;
@@ -1429,32 +1450,6 @@ be_visitor_ccm_pre_proc::gen_get_primary_key (be_home *node,
// ********************************************************************
int
-be_visitor_ccm_pre_proc::lookup_ccmobject (void)
-{
- if (be_global->ccmobject () != 0)
- {
- return 0;
- }
-
- Identifier local_id ("CCMObject");
- UTL_ScopedName local_name (&local_id,
- 0);
- UTL_ScopedName sn (&this->module_id_,
- &local_name);
- AST_Decl *d =
- idl_global->scopes ().top_non_null ()->lookup_by_name (&sn,
- true);
-
- if (d == 0)
- {
- return -1;
- }
-
- be_global->ccmobject (be_interface::narrow_from_decl (d));
- return 0;
-}
-
-int
be_visitor_ccm_pre_proc::lookup_cookie (be_component *node)
{
if (this->cookie_ == 0)
@@ -1644,18 +1639,18 @@ be_visitor_ccm_pre_proc::create_explicit (be_home *node)
false,
false,
true);
- parent_list->destroy ();
- UTL_ScopedName *explicit_name =
- this->create_scoped_name (0,
- node->local_name (),
- "Explicit",
- ScopeAsDecl (node->defined_in ()));
// We're at global scope here so we need to fool the scope stack
// for a minute so the correct repo id can be calculated at
// interface construction time.
idl_global->scopes ().push (node->defined_in ());
+ UTL_ScopedName *explicit_name =
+ this->create_scoped_name (0,
+ node->local_name (),
+ "Explicit",
+ ScopeAsDecl (node->defined_in ()));
+
AST_Interface *i = 0;
ACE_NEW_RETURN (i,
be_interface (explicit_name,
@@ -1695,6 +1690,11 @@ be_visitor_ccm_pre_proc::create_explicit (be_home *node)
d->set_name (new_name);
i->add_to_scope (d);
}
+
+ header.destroy ();
+ parent_list->destroy ();
+ delete parent_list;
+ parent_list = 0;
AST_Module *m = AST_Module::narrow_from_scope (node->defined_in ());
m->be_add_interface (i);
@@ -1704,18 +1704,24 @@ be_visitor_ccm_pre_proc::create_explicit (be_home *node)
AST_Interface *
be_visitor_ccm_pre_proc::create_implicit (be_home *node)
{
- Identifier parent_id ("KeylessCCMHome");
- UTL_ScopedName parent_local_name (&parent_id,
- 0);
- UTL_ScopedName parent_full_name (&this->module_id_,
- &parent_local_name);
- UTL_NameList parent_list (&parent_full_name,
- 0);
- UTL_ScopedName *implicit_name =
- this->create_scoped_name (0,
- node->local_name (),
- "Implicit",
- ScopeAsDecl (node->defined_in ()));
+ Identifier *parent_id = 0;
+ ACE_NEW_RETURN (parent_id,
+ Identifier ("KeylessCCMHome"),
+ 0);
+
+ UTL_ScopedName *parent_local_name = 0;
+ ACE_NEW_RETURN (parent_local_name,
+ UTL_ScopedName (parent_id, 0),
+ 0);
+
+ UTL_ScopedName *parent_full_name = 0;
+ ACE_NEW_RETURN (parent_full_name,
+ UTL_ScopedName (this->module_id_.copy (),
+ parent_local_name),
+ 0);
+
+ UTL_NameList parent_list (parent_full_name, 0);
+
UTL_NameList *parent_list_ptr = 0;
if (node->primary_key () == 0)
@@ -1728,13 +1734,18 @@ be_visitor_ccm_pre_proc::create_implicit (be_home *node)
false,
false,
true);
- parent_id.destroy ();
// We're at global scope here so we need to fool the scope stack
// for a minute so the correct repo id can be calculated at
// interface construction time.
idl_global->scopes ().push (node->defined_in ());
+ UTL_ScopedName *implicit_name =
+ this->create_scoped_name (0,
+ node->local_name (),
+ "Implicit",
+ ScopeAsDecl (node->defined_in ()));
+
AST_Interface *i = 0;
ACE_NEW_RETURN (i,
be_interface (implicit_name,
@@ -1748,13 +1759,18 @@ be_visitor_ccm_pre_proc::create_implicit (be_home *node)
// Back to reality.
idl_global->scopes ().pop ();
+
+ header.destroy ();
+ parent_list.destroy ();
i->set_name (implicit_name);
i->set_defined_in (node->defined_in ());
i->set_imported (node->imported ());
+
be_interface::narrow_from_decl (i)->gen_fwd_helper_name ();
AST_Module *m = AST_Module::narrow_from_scope (node->defined_in ());
m->be_add_interface (i);
+
return i;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_context.cpp b/TAO/TAO_IDL/be/be_visitor_context.cpp
index 287f3853b9c..d0bf0cd1a4b 100644
--- a/TAO/TAO_IDL/be/be_visitor_context.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_context.cpp
@@ -116,7 +116,6 @@ be_visitor_context::reset (void)
this->attr_ = 0;
this->exception_ = 0;
this->comma_ = 0;
-
}
void
diff --git a/TAO/TAO_IDL/be/be_visitor_decl.cpp b/TAO/TAO_IDL/be/be_visitor_decl.cpp
index 4be4948a498..379d71a67c8 100644
--- a/TAO/TAO_IDL/be/be_visitor_decl.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_decl.cpp
@@ -30,7 +30,6 @@ ACE_RCSID (be,
be_visitor_decl,
"$Id$")
-
// Root visitor for client header
be_visitor_decl::be_visitor_decl (be_visitor_context *ctx)
: ctx_ (ctx)
@@ -39,7 +38,12 @@ be_visitor_decl::be_visitor_decl (be_visitor_context *ctx)
be_visitor_decl::~be_visitor_decl (void)
{
-// delete this->ctx_;
+}
+
+be_visitor_context *
+be_visitor_decl::ctx (void)
+{
+ return this->ctx_;
}
int
diff --git a/TAO/TAO_IDL/be/be_visitor_interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface.cpp
index 2e7e3ff277f..6c0aa4b1d19 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface.cpp
@@ -23,6 +23,7 @@
#include "be_constant.h"
#include "be_enum.h"
#include "be_exception.h"
+#include "be_module.h"
#include "be_operation.h"
#include "be_structure.h"
#include "be_structure_fwd.h"
@@ -33,10 +34,10 @@
#include "be_component.h"
#include "be_helper.h"
#include "be_extern.h"
+#include "be_util.h"
#include "utl_identifier.h"
+#include "utl_exceptlist.h"
#include "nr_extern.h"
-#include "be_util.h"
-#include "be_module.h"
#include "be_visitor_interface.h"
#include "be_visitor_attribute.h"
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
index e87982b4447..0ac3043f090 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_ch.cpp
@@ -42,7 +42,7 @@ be_visitor_interface_any_op_ch::visit_interface (be_interface *node)
{
if (node->cli_hdr_any_op_gen ()
|| node->imported ()
- || node->is_local ())
+ || (node->is_local () && !be_global->gen_local_iface_anyops ()))
{
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
index 87e0899c0b2..fe23f84f78c 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/any_op_cs.cpp
@@ -40,7 +40,7 @@ be_visitor_interface_any_op_cs::visit_interface (be_interface *node)
{
if (node->cli_stub_any_op_gen ()
|| node->imported ()
- || node->is_local ())
+ || (node->is_local () && !be_global->gen_local_iface_anyops ()))
{
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp
index eb7c5cda9d4..f07aa96dbbb 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp
@@ -74,7 +74,10 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface (
<< inherited->full_direct_proxy_impl_name ();
}
- *os << be_uidt << be_uidt;
+ if (!first_concrete)
+ {
+ *os << be_uidt << be_uidt;
+ }
}
*os << be_nl
@@ -163,17 +166,9 @@ be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper (
// abstract interface in a concrete interface or component.
if (d->node_type () == AST_Decl::NT_op)
{
- AST_Operation *op = AST_Operation::narrow_from_decl (d);
- be_operation new_op (op->return_type (),
- op->flags (),
- &item_new_name,
- op->is_local (),
- node->is_abstract ());
- new_op.set_defined_in (node);
- be_visitor_interface::add_abstract_op_args (op,
- new_op);
+ be_operation *op = be_operation::narrow_from_decl (d);
be_visitor_operation_proxy_impl_xh op_visitor (&ctx);
- op_visitor.visit_operation (&new_op);
+ op_visitor.visit_operation (op);
}
else if (d->node_type () == AST_Decl::NT_attr)
{
@@ -184,11 +179,25 @@ be_visitor_interface_direct_proxy_impl_sh::gen_abstract_ops_helper (
attr->is_local (),
attr->is_abstract ());
new_attr.set_defined_in (node);
- new_attr.be_add_get_exceptions (attr->get_get_exceptions ());
- new_attr.be_add_set_exceptions (attr->get_set_exceptions ());
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
be_visitor_attribute attr_visitor (&ctx);
attr_visitor.visit_attribute (&new_attr);
ctx.attribute (0);
+ new_attr.destroy ();
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp
index 202657ad61c..97a20419a8c 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_ss.cpp
@@ -93,14 +93,25 @@ be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper (
-1);
}
- UTL_ScopedName *item_new_name = 0;
- ACE_NEW_RETURN (item_new_name,
- UTL_ScopedName (d->local_name ()->copy (),
- 0),
- -1);
+ AST_Decl::NodeType nt = d->node_type ();
+
+ UTL_ScopedName *item_new_name = 0;
+ UTL_ScopedName *new_name = 0;
+
+ if (AST_Decl::NT_op == nt || AST_Decl::NT_attr == nt)
+ {
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
- UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
- base->nconc (item_new_name);
+ new_name = (UTL_ScopedName *) node->name ()->copy ();
+ new_name->nconc (item_new_name);
+ }
+ else
+ {
+ continue;
+ }
// We pass the node's is_abstract flag to the operation
// constructor so we will get the right generated operation
@@ -108,22 +119,19 @@ be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper (
// abstract interface in a concrete interface or component.
if (d->node_type () == AST_Decl::NT_op)
{
- AST_Operation *op = AST_Operation::narrow_from_decl (d);
- be_operation new_op (op->return_type (),
- op->flags (),
- 0,
- op->is_local (),
- node->is_abstract ());
- new_op.set_defined_in (node);
- be_visitor_interface::add_abstract_op_args (op,
- new_op);
- new_op.set_name (base);
+ be_operation *op = be_operation::narrow_from_decl (d);
+ UTL_ScopedName *old_name =
+ (UTL_ScopedName *) op->name ()->copy ();
+ op->set_name (new_name);
+ op->set_defined_in (node);
+ op->is_abstract (node->is_abstract ());
+
be_visitor_operation_direct_proxy_impl_ss op_visitor (&ctx);
- op_visitor.visit_operation (&new_op);
-
- base->destroy ();
- delete base;
- base = 0;
+ op_visitor.visit_operation (op);
+
+ op->set_name (old_name);
+ op->set_defined_in (base);
+ op->is_abstract (base->is_abstract ());
}
else if (d->node_type () == AST_Decl::NT_attr)
{
@@ -134,12 +142,26 @@ be_visitor_interface_direct_proxy_impl_ss::gen_abstract_ops_helper (
attr->is_local (),
attr->is_abstract ());
new_attr.set_defined_in (node);
- new_attr.set_name (base);
- new_attr.be_add_get_exceptions (attr->get_get_exceptions ());
- new_attr.be_add_set_exceptions (attr->get_set_exceptions ());
+ new_attr.set_name (new_name);
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
be_visitor_attribute attr_visitor (&ctx);
attr_visitor.visit_attribute (&new_attr);
ctx.attribute (0);
+ new_attr.destroy ();
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
index dc72c8a0ead..b387023aa1b 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface.cpp
@@ -155,7 +155,12 @@ be_visitor_interface::add_abstract_op_args (AST_Operation *old_op,
new_op.add_to_scope (d);
}
- new_op.be_add_exceptions (old_op->exceptions ());
+ UTL_ExceptList *excep_list = old_op->exceptions ();
+
+ if (0 != excep_list)
+ {
+ new_op.be_add_exceptions (excep_list->copy ());
+ }
}
// All common visit methods for interface visitor.
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
index 6c26766524a..de8ec50359a 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp
@@ -175,8 +175,12 @@ be_visitor_interface_ch::visit_interface (be_interface *node)
<< "return static_cast<" << node->local_name ()
<< "_ptr> (0);" << be_uidt_nl
<< "}" << be_nl << be_nl;
+
+ bool gen_any_destructor =
+ be_global->any_support ()
+ && (!node->is_local () || be_global->gen_local_iface_anyops ());
- if (be_global->any_support () && !node->is_local ())
+ if (gen_any_destructor)
{
*os << "static void _tao_any_destructor (void *);";
}
@@ -420,21 +424,13 @@ be_visitor_interface_ch::gen_abstract_ops_helper (be_interface *node,
if (d->node_type () == AST_Decl::NT_op)
{
- UTL_ScopedName item_new_name (d->local_name (),
- 0);
-
- AST_Operation *op = AST_Operation::narrow_from_decl (d);
- be_operation new_op (op->return_type (),
- op->flags (),
- &item_new_name,
- node->is_local (),
- op->is_abstract ());
- new_op.set_defined_in (node);
- be_visitor_interface::add_abstract_op_args (op,
- new_op);
+
+ be_operation *op = be_operation::narrow_from_decl (d);
+ op->set_local (node->is_local ());
ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
be_visitor_operation_ch op_visitor (&ctx);
- op_visitor.visit_operation (&new_op);
+ op_visitor.visit_operation (op);
+ op->set_local (base->is_local ());
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
index 194d1359c97..0a4b34e5935 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_cs.cpp
@@ -262,7 +262,11 @@ be_visitor_interface_cs::visit_interface (be_interface *node)
<< " (void)" << be_nl;
*os << "{}" << be_nl << be_nl;
- if (be_global->any_support () && !node->is_local ())
+ bool gen_any_destructor =
+ be_global->any_support ()
+ && (!node->is_local () || be_global->gen_local_iface_anyops ());
+
+ if (gen_any_destructor)
{
*os << "void " << be_nl
<< node->name ()
@@ -630,30 +634,24 @@ be_visitor_interface_cs::gen_abstract_ops_helper (be_interface *node,
0),
-1);
- UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
- base->nconc (item_new_name);
-
- // We pass the node's is_abstract flag to the operation
- // constructor so we will get the right generated operation
- // body if we are regenerating an operation from an
- // abstract interface in a concrete interface or component.
- AST_Operation *op = AST_Operation::narrow_from_decl (d);
- be_operation new_op (op->return_type (),
- op->flags (),
- 0,
- op->is_local (),
- node->is_abstract ());
- new_op.set_defined_in (node);
- be_visitor_interface::add_abstract_op_args (op,
- new_op);
- new_op.set_name (base);
+ UTL_ScopedName *new_op_name =
+ (UTL_ScopedName *)node->name ()->copy ();
+ new_op_name->nconc (item_new_name);
+
+ be_operation *op = be_operation::narrow_from_decl (d);
+ UTL_ScopedName *old_op_name =
+ (UTL_ScopedName *) op->name ()->copy ();
+ op->set_name (new_op_name);
+ op->set_defined_in (node);
+ op->is_abstract (node->is_abstract ());
+
ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
be_visitor_operation_cs op_visitor (&ctx);
- op_visitor.visit_operation (&new_op);
-
- base->destroy ();
- delete base;
- base = 0;
+ op_visitor.visit_operation (op);
+
+ op->set_name (old_op_name);
+ op->set_defined_in (base);
+ op->is_abstract (base->is_abstract ());
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
index 1e5817b65ce..82a0472a7ed 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
@@ -341,17 +341,9 @@ be_visitor_interface_sh::gen_abstract_ops_helper (
if (d->node_type () == AST_Decl::NT_op)
{
- AST_Operation *op = AST_Operation::narrow_from_decl (d);
- be_operation new_op (op->return_type (),
- op->flags (),
- &item_new_name,
- op->is_local (),
- op->is_abstract ());
- new_op.set_defined_in (node);
- be_visitor_interface::add_abstract_op_args (op,
- new_op);
+ be_operation *op = be_operation::narrow_from_decl (d);
be_visitor_operation_sh op_visitor (&ctx);
- op_visitor.visit_operation (&new_op);
+ op_visitor.visit_operation (op);
}
else if (d->node_type () == AST_Decl::NT_attr)
{
@@ -362,11 +354,25 @@ be_visitor_interface_sh::gen_abstract_ops_helper (
attr->is_local (),
attr->is_abstract ());
new_attr.set_defined_in (node);
- new_attr.be_add_get_exceptions (attr->get_get_exceptions ());
- new_attr.be_add_set_exceptions (attr->get_set_exceptions ());
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
be_visitor_attribute attr_visitor (&ctx);
attr_visitor.visit_attribute (&new_attr);
ctx.attribute (0);
+ new_attr.destroy ();
}
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
index 2d3d7ebd54f..1f140530861 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_si.cpp
@@ -124,7 +124,10 @@ be_visitor_interface_si::visit_interface (be_interface *node)
int
be_visitor_interface_si::generate_amh_classes (be_interface *node)
{
- if (be_global->gen_amh_classes ())
+ // We have to check for an abstract ancestor until AMH is integrated
+ // with abstract interfaces. If the node itself is abstract, this
+ // visitor would not be created.
+ if (be_global->gen_amh_classes () && !node->has_mixed_parentage ())
{
be_visitor_amh_interface_si amh_intf (this->ctx_);
return amh_intf.visit_interface (node);
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
index 812d1f0d0cb..7b52627a051 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
@@ -174,7 +174,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
// @@ Cheat a little by placing a space before the operation name
// to prevent the IDL compiler from interpreting the leading
// underscore as an IDL escape.
- Identifier op_name (ACE_OS::strdup (" _is_a"));
+ Identifier op_name (" _is_a");
UTL_ScopedName scoped_name (&op_name, 0);
be_operation is_a (&rt,
AST_Operation::OP_noflags,
@@ -188,13 +188,14 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
idl_global->gen ()->create_expr ((idl_uns_long) 0,
AST_Expression::EV_ulong)));
- Identifier arg_name (ACE_OS::strdup ("repository_id"));
+ Identifier arg_name ("repository_id");
UTL_ScopedName scoped_arg_name (&arg_name, 0);
- be_argument repository_id (AST_Argument::dir_IN,
- s.get (),
- &scoped_arg_name);
+ AST_Argument *repository_id =
+ idl_global->gen ()->create_argument (AST_Argument::dir_IN,
+ s.get (),
+ &scoped_arg_name);
- is_a.be_add_argument (&repository_id);
+ is_a.be_add_argument (repository_id);
ACE_CString is_a_upcall_command_name =
"_is_a_" + ACE_CString (node_local_name) + "_Upcall_Command" ;
@@ -284,6 +285,10 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << be_uidt_nl
<< "}";
+
+ is_a.destroy ();
+ rt.destroy ();
+ s.get ()->destroy ();
}
// Generate code for the _non_existent skeleton.
@@ -292,7 +297,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
// @@ Cheat a little by placing a space before the operation name
// to prevent the IDL compiler from interpreting the leading
// underscore as an IDL escape.
- Identifier op_name (ACE_OS::strdup (" _non_existent"));
+ Identifier op_name (" _non_existent");
UTL_ScopedName scoped_name (&op_name, 0);
be_operation non_existent (&rt,
AST_Operation::OP_noflags,
@@ -388,6 +393,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << be_uidt_nl
<< "}";
+
+ non_existent.destroy ();
+ rt.destroy ();
}
// Generate code for the _repository_id skeleton.
@@ -400,7 +408,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
// @@ Cheat a little by placing a space before the operation name
// to prevent the IDL compiler from interpreting the leading
// underscore as an IDL escape.
- Identifier op_name (ACE_OS::strdup (" _repository_id"));
+ Identifier op_name (" _repository_id");
UTL_ScopedName scoped_name (&op_name, 0);
be_operation repository_id (s.get (),
AST_Operation::OP_noflags,
@@ -496,6 +504,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
*os << be_uidt_nl
<< "}";
+
+ repository_id.destroy ();
+ s.get ()->destroy ();
}
*os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl
@@ -564,7 +575,7 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
// underscore as an IDL escape.
// Yes, _get_component()
- Identifier op_name (ACE_OS::strdup (" _get_component"));
+ Identifier op_name (" _get_component");
UTL_ScopedName scoped_name (&op_name, 0);
be_operation get_component (&rt,
AST_Operation::OP_noflags,
@@ -655,6 +666,9 @@ be_visitor_interface_ss::visit_interface (be_interface *node)
<< (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER")
<< ");" << TAO_ACE_CHECK () << be_uidt_nl
<< "}";
+
+ get_component.destroy ();
+ rt.destroy ();
}
// Generate code for the _is_a override.
@@ -752,36 +766,48 @@ be_visitor_interface_ss::gen_abstract_ops_helper (be_interface *node,
"bad node in this scope\n"),
-1);
}
+
+ AST_Decl::NodeType nt = d->node_type ();
+
+ UTL_ScopedName *item_new_name = 0;
+ UTL_ScopedName *new_name = 0;
+
+ if (AST_Decl::NT_op == nt || AST_Decl::NT_attr == nt)
+ {
+ ACE_NEW_RETURN (item_new_name,
+ UTL_ScopedName (d->local_name ()->copy (),
+ 0),
+ -1);
- UTL_ScopedName *item_new_name = 0;
- ACE_NEW_RETURN (item_new_name,
- UTL_ScopedName (d->local_name ()->copy (),
- 0),
- -1);
-
- UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
- base->nconc (item_new_name);
+ new_name = (UTL_ScopedName *) node->name ()->copy ();
+ new_name->nconc (item_new_name);
+ }
+ else
+ {
+ continue;
+ }
- if (d->node_type () == AST_Decl::NT_op)
+ // We pass the node's is_abstract flag to the operation
+ // constructor so we will get the right generated operation
+ // body if we are regenerating an operation from an
+ // abstract interface in a concrete interface or component.
+ if (AST_Decl::NT_op == nt)
{
- // We pass the node's is_abstract flag to the operation
- // constructor so we will get the right generated operation
- // body if we are regenerating an operation from an
- // abstract interface in a concrete interface or component.
- AST_Operation *op = AST_Operation::narrow_from_decl (d);
- be_operation new_op (op->return_type (),
- op->flags (),
- 0,
- op->is_local (),
- node->is_abstract ());
- new_op.set_defined_in (node);
- be_visitor_interface::add_abstract_op_args (op,
- new_op);
- new_op.set_name (base);
+ be_operation *op = be_operation::narrow_from_decl (d);
+ UTL_ScopedName *old_name =
+ (UTL_ScopedName *) op->name ()->copy ();
+ op->set_name (new_name);
+ op->set_defined_in (node);
+ op->is_abstract (node->is_abstract ());
+
be_visitor_operation_ss op_visitor (&ctx);
- op_visitor.visit_operation (&new_op);
+ op_visitor.visit_operation (op);
+
+ op->set_name (old_name);
+ op->set_defined_in (base);
+ op->is_abstract (base->is_abstract ());
}
- else if (d->node_type () == AST_Decl::NT_attr)
+ else if (AST_Decl::NT_attr == nt)
{
AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
be_attribute new_attr (attr->readonly (),
@@ -790,17 +816,27 @@ be_visitor_interface_ss::gen_abstract_ops_helper (be_interface *node,
attr->is_local (),
attr->is_abstract ());
new_attr.set_defined_in (node);
- new_attr.set_name (base);
- new_attr.be_add_get_exceptions (attr->get_get_exceptions ());
- new_attr.be_add_set_exceptions (attr->get_set_exceptions ());
+ new_attr.set_name (new_name);
+
+ UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();
+
+ if (0 != get_exceptions)
+ {
+ new_attr.be_add_get_exceptions (get_exceptions->copy ());
+ }
+
+ UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();
+
+ if (0 != set_exceptions)
+ {
+ new_attr.be_add_set_exceptions (set_exceptions->copy ());
+ }
+
be_visitor_attribute attr_visitor (&ctx);
attr_visitor.visit_attribute (&new_attr);
ctx.attribute (0);
+ new_attr.destroy ();
}
-
- base->destroy ();
- delete base;
- base = 0;
}
return 0;
diff --git a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp b/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp
deleted file mode 100644
index d406126bcd6..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_interface/remote_proxy_impl_cs.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-//
-// $Id$
-//
-
-ACE_RCSID (be_visitor_interface,
- remote_proxy_impl_cs,
- "$Id$")
-
-be_visitor_interface_remote_proxy_impl_cs::
-be_visitor_interface_remote_proxy_impl_cs (be_visitor_context *ctx)
- : be_visitor_interface (ctx)
-{
- // No-Op.
-}
-
-be_visitor_interface_remote_proxy_impl_cs::
-~be_visitor_interface_remote_proxy_impl_cs (void)
-{
- // No-Op.
-}
-
-int
-be_visitor_interface_remote_proxy_impl_cs::visit_interface (
- be_interface *node
- )
-{
- TAO_OutStream *os = this->ctx_->stream ();
- os->decr_indent (0);
-
- *os << be_nl << "// TAO_IDL - Generated from" << be_nl
- << "// " << __FILE__ << ":" << __LINE__ << be_nl;
-
- *os << be_nl
- << "///////////////////////////////////////////////////////////////////////"
- << be_nl
- << "// Base & Remote Proxy Implementation. " << be_nl
- << "//" << be_nl << be_nl;
- // Create the destructor implementation for the base
- // proxy implementation.
-
- // Ctor Impl.
- *os << node->full_base_proxy_impl_name () << "::"
- << node->base_proxy_impl_name () << " (void)" << be_nl
- << "{}" << be_nl << be_nl;
-
- // Create the destructor implementation for the remote
- // proxy implementation.
-
- // Ctor Impl
- *os << node->full_remote_proxy_impl_name () << "::"
- << node->remote_proxy_impl_name () << " (void)" << be_nl
- << "{}" << be_nl << be_nl;
-
- // Generate the code for the Remote Proxy Impl.
- // operations
- *os << "// Remote Implementation of the IDL interface methods";
-
- if (this->visit_scope (node) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "be_visitor_interface_cs::"
- "visit_interface - "
- "codegen for Base Proxy Broker class failed\n"),
- -1);
- }
-
- *os << be_nl << be_nl
- << "//" << be_nl
- << "// End Base & Remote Proxy Implemeentation. " << be_nl
- << "///////////////////////////////////////////////////////////////////////"
- << be_nl << be_nl;
-
- return 0;
-}
-
-int
-be_visitor_interface_remote_proxy_impl_cs::gen_abstract_ops_helper (
- be_interface *node,
- be_interface *base,
- TAO_OutStream *os
- )
-{
- if (node == base)
- {
- return 0;
- }
-
- AST_Decl *d = 0;
- be_visitor_context ctx;
- ctx.stream (os);
-
- for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
- !si.is_done ();
- si.next ())
- {
- d = si.item ();
-
- if (d == 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_interface_remote_proxy_"
- "impl_cs::abstract_base_ops_helper - "
- "bad node in this scope\n"),
- -1);
- }
-
- if (d->node_type () == AST_Decl::NT_op)
- {
- UTL_ScopedName *item_new_name = 0;
- ACE_NEW_RETURN (item_new_name,
- UTL_ScopedName (d->local_name ()->copy (),
- 0),
- -1);
-
- UTL_ScopedName *base = (UTL_ScopedName *)node->name ()->copy ();
- base->nconc (item_new_name);
-
- // We pass the node's is_abstract flag to the operation
- // constructor so we will get the right generated operation
- // body if we are regenerating an operation from an
- // abstract interface in a concrete interface or component.
- AST_Operation *op = AST_Operation::narrow_from_decl (d);
- be_operation new_op (op->return_type (),
- op->flags (),
- 0,
- op->is_local (),
- node->is_abstract ());
- new_op.set_defined_in (node);
- be_visitor_interface::add_abstract_op_args (op,
- new_op);
- new_op.set_name (base);
- be_visitor_operation_remote_proxy_impl_cs op_visitor (&ctx);
- op_visitor.visit_operation (&new_op);
-
- base->destroy ();
- delete base;
- base = 0;
- }
- }
-
- return 0;
-}
-
-int be_visitor_interface_remote_proxy_impl_cs::visit_component (
- be_component *node
- )
-{
- return this->visit_interface (node);
-}
-
-
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp
index 75cf81f5be5..d08ba25559b 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/any_op_ch.cpp
@@ -39,14 +39,15 @@ be_visitor_interface_fwd_any_op_ch::~be_visitor_interface_fwd_any_op_ch (void)
}
int
-be_visitor_interface_fwd_any_op_ch::visit_interface_fwd (be_interface_fwd *node)
+be_visitor_interface_fwd_any_op_ch::visit_interface_fwd (
+ be_interface_fwd *node
+ )
{
- AST_Interface *fd = node->full_definition ();
-
- // Only a forward declared interface that is not defined in the same file
- // needs to have this generated here. The Any operators are needed by
- // portable interceptor code if the interface is a parameter of an operation.
- if (fd->is_defined () != 0 || node->is_local ())
+ // Only a forward declared interface that is not defined in the same
+ // translation unit needs to have this generated here. The Any operators
+ // are needed by portable interceptor code if the interface is a
+ // parameter of an operation.
+ if (node->full_def_seen () || node->is_local ())
{
return 0;
}
@@ -70,11 +71,11 @@ be_visitor_interface_fwd_any_op_ch::visit_interface_fwd (be_interface_fwd *node)
{
module = be_module::narrow_from_scope (node->defined_in ());
- if (!module)
+ if (0 == module)
{
ACE_ERROR_RETURN ((LM_ERROR,
"be_visitor_valuebox_any_op_ch::"
- "visit_valuebox - "
+ "visit_interface_fwd - "
"Error parsing nested name\n"),
-1);
}
diff --git a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp
index 325ba44622c..442d4bd54f0 100644
--- a/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_interface_fwd/cdr_op_ch.cpp
@@ -42,13 +42,11 @@ be_visitor_interface_fwd_cdr_op_ch::~be_visitor_interface_fwd_cdr_op_ch (void)
int
be_visitor_interface_fwd_cdr_op_ch::visit_interface_fwd (be_interface_fwd *node)
{
- AST_Interface *fd = node->full_definition ();
-
// If this forward declared interface is defined later in the file,
// the CDR operator declaration (along with the corresponding
// declarations for members of the interface's scope) will be
// generated then.
- if (fd->is_defined () || node->is_local ())
+ if (node->full_def_seen () || node->is_local ())
{
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
index 2721936beae..c7c87e524fd 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp
@@ -152,7 +152,7 @@ be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node)
{
// Remove the trailing '_excep' from the operation name, we know
// there is one from the checks above...
- ACE_CString operation_name (node->full_name ());
+ ACE_CString operation_name (node->local_name ()->get_string ());
ssize_t idx = operation_name.rfind ('_');
ACE_ASSERT (idx != ACE_String_Base_Const::npos);
operation_name[idx] = '\0';
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
index c1071830315..333063bd543 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp
@@ -141,7 +141,11 @@ be_visitor_amh_operation_sh::visit_attribute (be_attribute *node)
be_visitor_context ctx (*this->ctx_);
be_visitor_args_arglist visitor (&ctx);
- if (visitor.visit_argument (&the_argument) == -1)
+ int status = visitor.visit_argument (&the_argument);
+
+ the_argument.destroy ();
+
+ if (-1 == status)
{
return -1;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
index bdb5192bb28..909176025cf 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp
@@ -222,14 +222,21 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node)
be_argument the_argument (AST_Argument::dir_IN,
node->field_type (),
node->name ());
+
+ int status = 0;
- be_visitor_context ctx (*this->ctx_);
- be_visitor_args_vardecl_ss visitor (&ctx);
+ {
+ be_visitor_context ctx (*this->ctx_);
+ be_visitor_args_vardecl_ss vardecl_visitor (&ctx);
- if (visitor.visit_argument (&the_argument) == -1)
- {
- return -1;
- }
+ status = vardecl_visitor.visit_argument (&the_argument);
+
+ if (-1 == status)
+ {
+ the_argument.destroy ();
+ return -1;
+ }
+ }
*os << be_nl
<< "TAO_InputCDR & _tao_in ="
@@ -241,10 +248,13 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_OPERATION_ARG_DEMARSHAL_SS);
ctx.sub_state (TAO_CodeGen::TAO_CDR_INPUT);
- be_visitor_args_marshal_ss visitor (&ctx);
+ be_visitor_args_marshal_ss marshal_visitor (&ctx);
- if (visitor.visit_argument (&the_argument) == -1)
+ status = marshal_visitor.visit_argument (&the_argument);
+
+ if (-1 == status)
{
+ the_argument.destroy ();
return -1;
}
}
@@ -253,9 +263,10 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node)
<< "{" << be_idt_nl;
// If marshaling fails, raise exception.
- if (this->gen_raise_exception (0,
- "::CORBA::MARSHAL",
- "") == -1)
+ status = this->gen_raise_exception (0,
+ "::CORBA::MARSHAL",
+ "");
+ if (-1 == status)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) gen_raise_exception failed\n"),
@@ -265,7 +276,7 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node)
*os << be_uidt_nl
<< "}" << be_uidt_nl;
- if (this->generate_shared_section (node, os) == -1)
+ if (-1 == this->generate_shared_section (node, os))
{
return -1;
}
@@ -273,9 +284,11 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node)
*os << ",";
{
- be_visitor_args_upcall_ss visitor (this->ctx_);
-
- if (visitor.visit_argument (&the_argument) == -1)
+ be_visitor_args_upcall_ss upcall_visitor (this->ctx_);
+ status = upcall_visitor.visit_argument (&the_argument);
+ the_argument.destroy ();
+
+ if (-1 == status)
{
return -1;
}
@@ -283,7 +296,7 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node)
*os << env_arg;
- if (this->generate_shared_epilogue (os) == -1)
+ if (-1 == this->generate_shared_epilogue (os))
{
return -1;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
index eb0f4a3f692..499e8884793 100644
--- a/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_ch.cpp
@@ -88,6 +88,14 @@ be_visitor_operation_ami_ch::visit_operation (be_operation *node)
be_visitor_context ctx (*this->ctx_);
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH);
be_visitor_operation_arglist visitor (&ctx);
+ be_operation *arguments = node->arguments ();
+
+ // If a local node's parent has a sendc_* operation, we must
+ // regenerate it as pure virtual, so we temporarily set the
+ // strategy-related node to local, if necessary, and restore
+ // it after the visitor returns.
+ bool orig_local = arguments->is_local ();
+ arguments->set_local (node->is_local ());
if (node->arguments ()->accept (&visitor) == -1)
{
@@ -98,5 +106,6 @@ be_visitor_operation_ami_ch::visit_operation (be_operation *node)
-1);
}
+ arguments->set_local (orig_local);
return 0;
}
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp
index 3b7978ea2fc..c60346a545a 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/enum_typecode.cpp
@@ -34,7 +34,8 @@ TAO::be_visitor_enum_typecode::visit_enum (be_enum * node)
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
- std::string const enumerators_name (std::string ("_tao_enumerators_")
+ static ACE_CString const tao_enumerators ("_tao_enumerators_");
+ ACE_CString const enumerators_name (tao_enumerators
+ node->flat_name ());
// Generate array containing enum field characteristics.
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
index a6632d5dae7..d2b54b60440 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
@@ -77,9 +77,6 @@ int
TAO::be_visitor_struct_typecode::visit (AST_Structure * node,
bool is_exception)
{
- // Exceptions cannot be recursive.
-// ACE_ASSERT (!is_exception || (is_exception && !this->in_recursion_));
-
this->is_nested_ = true;
TAO_OutStream & os = *this->ctx_->stream ();
@@ -96,7 +93,8 @@ TAO::be_visitor_struct_typecode::visit (AST_Structure * node,
"TypeCodes.\n"),
-1);
- std::string const fields_name (std::string ("_tao_fields_")
+ static ACE_CString const tao_fields ("_tao_fields_");
+ ACE_CString const fields_name (tao_fields
+ node->flat_name ());
// Generate array containing struct field characteristics.
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp
index 4e0f57f54b1..018da3d959d 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp
@@ -147,7 +147,8 @@ TAO::be_visitor_union_typecode::visit_cases (be_union * node)
be_type * const discriminant_type =
be_type::narrow_from_decl (node->disc_type ());
- std::string const fields_name (std::string ("_tao_cases_")
+ static ACE_CString tao_cases ("_tao_cases_");
+ ACE_CString const fields_name (tao_cases
+ node->flat_name ());
TAO_OutStream & os = *this->ctx_->stream ();
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
index 407a83f61b9..2db4462bc35 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype.cpp
@@ -30,6 +30,7 @@
#include "be_eventtype_fwd.h"
#include "be_factory.h"
#include "be_field.h"
+#include "be_generator.h"
#include "be_interface_fwd.h"
#include "be_module.h"
#include "be_predefined_type.h"
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
index 58f53155d48..ebbbd55dca8 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp
@@ -121,6 +121,8 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
"codegen for get_attribute failed\n"),
-1);
}
+
+ get_op.destroy ();
if (node->readonly ())
{
@@ -137,11 +139,12 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
&sn);
// Argument type is the same as the attribute type.
- be_argument arg (AST_Argument::dir_IN,
- node->field_type (),
- node->name ());
+ AST_Argument *arg =
+ idl_global->gen ()->create_argument (AST_Argument::dir_IN,
+ node->field_type (),
+ node->name ());
- arg.set_name ((UTL_IdList *) node->name ()->copy ());
+ arg->set_name ((UTL_IdList *) node->name ()->copy ());
// Create the operation.
be_operation set_op (&rt,
@@ -151,7 +154,7 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
0);
set_op.set_name ((UTL_IdList *) node->name ()->copy ());
- set_op.be_add_argument (&arg);
+ set_op.be_add_argument (arg);
if (this->visit_operation (&set_op) == -1)
{
@@ -161,6 +164,9 @@ be_visitor_valuetype::visit_attribute (be_attribute *node)
"codegen for set_attribute failed\n"),
-1);
}
+
+ set_op.destroy ();
+ rt.destroy ();
return 0;
}
@@ -812,6 +818,11 @@ be_visitor_valuetype::gen_obv_init_constructor_args (be_valuetype *node,
&sn);
ft->seen_in_operation (seen);
visitor.visit_argument (&arg);
+
+ // AST_Argument inherits from AST_Field, which will destroy
+ // its field type if it is anonymous - we don't want that.
+ arg.be_decl::destroy ();
+ arg.AST_Decl::destroy ();
id.destroy ();
}
}
@@ -891,16 +902,7 @@ be_visitor_valuetype::gen_init_impl (be_valuetype *node)
bool
be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node)
{
- // VT needs RefCounter if it has concrete factory or supports an
- // abstract interface and none of its base VT has ref_counter
-
- if (node->determine_factory_style () != be_valuetype::FS_CONCRETE_FACTORY
- && !node->supports_abstract ())
- {
- return 0;
- }
-
- // Now go thru our base VTs and see if one has already.
+ // Go thru our base VTs and see if one has already.
for (int i = 0; i < node->n_inherits (); ++i)
{
be_valuetype *vt =
@@ -910,12 +912,27 @@ be_visitor_valuetype::obv_need_ref_counter (be_valuetype* node)
{
if (be_visitor_valuetype::obv_have_ref_counter (vt))
{
- return 0;
+ return false;
}
}
}
- return 1;
+ // If we inherit from CORBA::Object and/or CORBA::AbstractBase
+ // (in addition to CORBA::ValueBase) we have to override _add_ref()
+ // and _remove_ref() by calling the one in DefaultValueRefCountBase
+ // to avoid ambiguity.
+ if (node->n_supports () > 0)
+ {
+ return true;
+ }
+
+ // VT needs RefCounter if it has concrete factory.
+ if (be_valuetype::FS_CONCRETE_FACTORY == node->determine_factory_style ())
+ {
+ return true;
+ }
+
+ return false;
}
bool
@@ -925,12 +942,12 @@ be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node)
// Just try to find a VT with concrete factory in inheritance tree.
if (node == 0)
{
- return 0;
+ return false;
}
if (node->determine_factory_style () == be_valuetype::FS_CONCRETE_FACTORY)
{
- return 1;
+ return true;
}
// Now go thru our base VTs.
@@ -942,12 +959,12 @@ be_visitor_valuetype::obv_have_ref_counter (be_valuetype* node)
{
if (be_visitor_valuetype::obv_have_ref_counter (vt))
{
- return 1;
+ return true;
}
}
}
- return 0;
+ return false;
}
bool
diff --git a/TAO/TAO_IDL/be_include/be_argument.h b/TAO/TAO_IDL/be_include/be_argument.h
index 8ecc9fa638f..b000118841a 100644
--- a/TAO/TAO_IDL/be_include/be_argument.h
+++ b/TAO/TAO_IDL/be_include/be_argument.h
@@ -42,6 +42,9 @@ public:
// Visiting.
virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS2 (be_argument, AST_Argument, be_decl);
diff --git a/TAO/TAO_IDL/be_include/be_array.h b/TAO/TAO_IDL/be_include/be_array.h
index 70f5f309ac0..f5d5ffe7049 100644
--- a/TAO/TAO_IDL/be_include/be_array.h
+++ b/TAO/TAO_IDL/be_include/be_array.h
@@ -52,6 +52,9 @@ public:
// Visiting.
virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS2 (be_array, AST_Array, be_type);
diff --git a/TAO/TAO_IDL/be_include/be_attribute.h b/TAO/TAO_IDL/be_include/be_attribute.h
index 74f245a48e6..ca78e671bea 100644
--- a/TAO/TAO_IDL/be_include/be_attribute.h
+++ b/TAO/TAO_IDL/be_include/be_attribute.h
@@ -65,6 +65,9 @@ public:
be_operation_strategy *get_set_strategy (void);
// Retrieve the underlying set_operation strategy.
+
+ virtual void destroy (void);
+ // Cleanup.
// Narrowing
DEF_NARROW_METHODS2 (be_attribute, AST_Attribute, be_decl);
diff --git a/TAO/TAO_IDL/be_include/be_codegen.h b/TAO/TAO_IDL/be_include/be_codegen.h
index 356ed54b3c6..eec0d597bb5 100644
--- a/TAO/TAO_IDL/be_include/be_codegen.h
+++ b/TAO/TAO_IDL/be_include/be_codegen.h
@@ -387,6 +387,9 @@ public:
void gen_ident_string (TAO_OutStream *stream) const;
// Pass along the #ident string, if any, from the IDL file.
+
+ void destroy (void);
+ // Cleanup.
private:
void gen_ifndef_string (const char *fname,
diff --git a/TAO/TAO_IDL/be_include/be_extern.h b/TAO/TAO_IDL/be_include/be_extern.h
index 9706ed03a7b..2ec5afe4f79 100644
--- a/TAO/TAO_IDL/be_include/be_extern.h
+++ b/TAO/TAO_IDL/be_include/be_extern.h
@@ -73,9 +73,10 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
extern TAO_IDL_BE_Export BE_GlobalData *be_global;
extern TAO_IDL_BE_Export int BE_init (int &, char*[]);
-extern TAO_IDL_BE_Export void BE_post_init (const char *[], long);
+extern TAO_IDL_BE_Export void BE_post_init (char *[], long);
extern TAO_IDL_BE_Export void BE_version (void);
extern TAO_IDL_BE_Export void BE_produce (void);
+extern TAO_IDL_BE_Export void BE_cleanup (void);
extern TAO_IDL_BE_Export void BE_abort (void);
#endif // _BE_EXTERN_BE_EXTERN_HH
diff --git a/TAO/TAO_IDL/be_include/be_field.h b/TAO/TAO_IDL/be_include/be_field.h
index 95147f7bd91..75a17bb495b 100644
--- a/TAO/TAO_IDL/be_include/be_field.h
+++ b/TAO/TAO_IDL/be_include/be_field.h
@@ -41,6 +41,9 @@ public:
// Visiting.
virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS2 (be_field, AST_Field, be_decl);
diff --git a/TAO/TAO_IDL/be_include/be_generator.h b/TAO/TAO_IDL/be_include/be_generator.h
index ddbed2d438b..38c6003cb82 100644
--- a/TAO/TAO_IDL/be_include/be_generator.h
+++ b/TAO/TAO_IDL/be_include/be_generator.h
@@ -95,12 +95,12 @@ public:
long nih,
AST_Interface **ih_flat,
long nih_flat,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_InterfaceFwd *create_interface_fwd (UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
// Create a node representing a boxed value type
virtual AST_ValueBox *create_valuebox (UTL_ScopedName *n,
@@ -112,12 +112,12 @@ public:
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom);
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom);
virtual AST_ValueTypeFwd *create_valuetype_fwd (UTL_ScopedName *n,
bool abstract);
@@ -128,19 +128,19 @@ public:
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom);
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom);
virtual AST_EventTypeFwd *create_eventtype_fwd (UTL_ScopedName *n,
bool abstract);
virtual AST_Component *create_component (UTL_ScopedName *n,
AST_Component *base_component,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat);
@@ -151,30 +151,30 @@ public:
AST_Home *base_home,
AST_Component *managed_component,
AST_ValueType *primary_key,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat);
virtual AST_Exception *create_exception (UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_Structure *create_structure (UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_StructureFwd *create_structure_fwd (UTL_ScopedName *n);
virtual AST_Enum *create_enum (UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_Operation *create_operation (AST_Type *rt,
AST_Operation::Flags fl,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_Field *create_field (AST_Type *ft, UTL_ScopedName *n,
AST_Field::Visibility vis =
@@ -187,13 +187,13 @@ public:
virtual AST_Attribute *create_attribute (bool ro,
AST_Type *ft,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_Union *create_union (AST_ConcreteType *dt,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n);
@@ -240,14 +240,14 @@ public:
virtual AST_Array *create_array (UTL_ScopedName *n,
unsigned long ndims,
UTL_ExprList *dims,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_Sequence *create_sequence (AST_Expression *v,
AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
virtual AST_String *create_string (AST_Expression *v);
@@ -255,8 +255,8 @@ public:
virtual AST_Typedef *create_typedef (AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
// Create a node representing a native
virtual AST_Native *create_native (UTL_ScopedName *n);
diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h
index cc20432939c..402db81f511 100644
--- a/TAO/TAO_IDL/be_include/be_global.h
+++ b/TAO/TAO_IDL/be_include/be_global.h
@@ -28,6 +28,8 @@
class be_interface;
class be_valuetype;
+class be_module;
+class be_interface;
class be_interface_fwd;
class UTL_String;
class AST_PredefinedType;
@@ -475,18 +477,25 @@ public:
// CORBA::is_nil, needed when the interface inherits versions from
// both CORBA::Object and CORBA::AbstractBase.
- AST_PredefinedType *void_type (void) const;
- void void_type (AST_PredefinedType *val);
- // Accessors for the member.
+ AST_PredefinedType *void_type (void);
+ // Accessor for the member, sets it on the first call.
- be_interface *ccmobject (void) const;
- void ccmobject (be_interface *val);
- // Accessors for the member.
+ be_interface *ccmobject (void);
+ // Accessor for the member, sets it on the first call.
+
+ be_module *messaging (void);
+ // Accessor for the member, sets it on the first call.
+ be_valuetype *messaging_exceptionholder (void);
+ // Accessor for the member, sets it on the first call.
+
be_valuetype *exceptionholder (void) const;
void exceptionholder (be_valuetype *val);
// Accessors for the member.
-
+
+ be_interface *messaging_replyhandler (void);
+ // Accessor for the member, sets it on the first call.
+
bool gen_anyop_files (void) const;
void gen_anyop_files (bool val);
// Accessors for the member.
@@ -502,6 +511,10 @@ public:
bool gen_server_inline (void) const;
void gen_server_inline (bool val);
// Accessors for the member gen_server_inline_.
+
+ bool gen_local_iface_anyops (void) const;
+ void gen_local_iface_anyops (bool val);
+ // Accessors for the member gen_local_iface_anyops_.
ACE_CString spawn_options (void);
// Command line passed to ACE_Process::spawn. Different
@@ -682,9 +695,18 @@ private:
be_interface *ccmobject_;
// Reference holder for component skeleton visitors.
+ be_module *messaging_;
+ // Storage for the messaging exceptions holder's virtual scope.
+
+ be_valuetype *messaging_exceptionholder_;
+ // Storage for exception holders' base class node.
+
be_valuetype *exceptionholder_;
// Reference holder for the exceptionholder.
-
+
+ be_interface *messaging_replyhandler_;
+ // Storage for the reply handlers' base class node.
+
bool gen_anyop_files_;
// Separate files for generated Any operators?
@@ -699,6 +721,10 @@ private:
bool gen_server_inline_;
// True by default, but a command line option can turn this off so
// that we don't generate a server inline file
+
+ bool gen_local_iface_anyops_;
+ // True by default, can be turned off by a command line option
+ // for regenerating internal ORB files.
};
#endif /* _BE_GLOBAL_H */
diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h
index c4af6c6d1c4..bde3d221124 100644
--- a/TAO/TAO_IDL/be_include/be_interface.h
+++ b/TAO/TAO_IDL/be_include/be_interface.h
@@ -377,7 +377,7 @@ protected:
int var_out_seq_decls_gen_;
// Have these been done already?
-private:
+protected:
int skel_count_;
// Number of static skeletons in the operation table.
diff --git a/TAO/TAO_IDL/be_include/be_interface_strategy.h b/TAO/TAO_IDL/be_include/be_interface_strategy.h
index ebaf348dd81..b5c885ef3f7 100644
--- a/TAO/TAO_IDL/be_include/be_interface_strategy.h
+++ b/TAO/TAO_IDL/be_include/be_interface_strategy.h
@@ -42,7 +42,7 @@ public:
be_interface_strategy (be_interface *node,
Strategy_Kind strategy_type);
- virtual ~be_interface_strategy ();
+ virtual ~be_interface_strategy (void);
virtual const char *local_name (void) = 0;
// return the local name
@@ -140,29 +140,36 @@ public:
const char *suffix);
// compute the collocation names
- virtual TAO_OutStream *get_out_stream ();
+ virtual TAO_OutStream *get_out_stream (void);
// return the out stream depending on the strategy
// @@ Michael: Right now every strategy behaves
// the same way, but it might be in the future that we
// have to differentiate.
- virtual const char *get_out_stream_fname ();
+ virtual const char *get_out_stream_fname (void);
// return the file name of the output stream.
// @@ Michael: Right now every strategy behaves the
// same way.
- int strategy_type ();
+ int strategy_type (void);
// Return the type of the strategy.
- virtual TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state = 0);
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ );
// Change the sate if necessary
- virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
+ virtual int has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ );
virtual be_interface *replacement (void);
// Returns the node, which is used instead of the original node,
// e.g. the reply handler to the actual node.
+
+ virtual void destroy (void);
+ // Cleanup.
protected:
char *local_name_;
@@ -199,7 +206,7 @@ public:
be_interface_default_strategy (be_interface *node,
Strategy_Kind strategy_type = DEFAULT);
- virtual ~be_interface_default_strategy ();
+ virtual ~be_interface_default_strategy (void);
const char * local_name (void);
// return the local name
@@ -278,7 +285,9 @@ public:
virtual const char *flat_server_scope (void);
// Return the "flat" version of the scope
//that encloses the interface.
-
+
+ virtual void destroy (void);
+ // Cleanup.
// end of overridden methods
@@ -288,7 +297,8 @@ protected:
const char *str,
const char *suffix,
const char *separator = "");
- // create a new string made by the concatenation of "str" and "suffix" and using the
+ // create a new string made by the concatenation
+ // of "str" and "suffix" and using the
// "separator" to concatenate the two.
@@ -349,11 +359,13 @@ class be_interface_ami_handler_strategy
public:
be_interface_ami_handler_strategy (be_interface *node);
- virtual ~be_interface_ami_handler_strategy ();
+ virtual ~be_interface_ami_handler_strategy (void);
// overridden methods.
- virtual TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state = 0);
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ );
};
@@ -363,13 +375,17 @@ class be_interface_ami_exception_holder_strategy
public:
be_interface_ami_exception_holder_strategy (be_interface *node);
- virtual ~be_interface_ami_exception_holder_strategy ();
+ virtual ~be_interface_ami_exception_holder_strategy (void);
// overridden methods.
- virtual TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state = 0);
-
- virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ );
+
+ virtual int has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ );
};
class be_interface_ami_strategy
@@ -382,10 +398,14 @@ public:
virtual ~be_interface_ami_strategy ();
// overridden methods.
- virtual TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
- int is_extra_state = 0);
-
- virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
+ virtual TAO_CodeGen::CG_STATE next_state (
+ TAO_CodeGen::CG_STATE current_state,
+ int is_extra_state = 0
+ );
+
+ virtual int has_extra_code_generation (
+ TAO_CodeGen::CG_STATE current_state
+ );
virtual be_interface *replacement (void);
diff --git a/TAO/TAO_IDL/be_include/be_native.h b/TAO/TAO_IDL/be_include/be_native.h
index ad07f1a302e..453915d2aa5 100644
--- a/TAO/TAO_IDL/be_include/be_native.h
+++ b/TAO/TAO_IDL/be_include/be_native.h
@@ -51,6 +51,9 @@ public:
virtual long tc_size (void);
// Return typecode size.
+
+ virtual void destroy (void);
+ // Cleanup.
// Visiting.
virtual int accept (be_visitor *visitor);
diff --git a/TAO/TAO_IDL/be_include/be_operation_strategy.h b/TAO/TAO_IDL/be_include/be_operation_strategy.h
index 310a3d4f1e7..fae1e18d483 100644
--- a/TAO/TAO_IDL/be_include/be_operation_strategy.h
+++ b/TAO/TAO_IDL/be_include/be_operation_strategy.h
@@ -42,7 +42,7 @@ public:
virtual ~be_operation_strategy (void);
- int strategy_type ();
+ int strategy_type (void);
// Return the type of the strategy.
virtual TAO_CodeGen::CG_STATE next_state (
@@ -63,9 +63,14 @@ public:
// Returns a customized arguments list, e.g. AMI sendc_ operations
// only use the in and inout arguments but not the out arguments,
// also the first argument is the reply handler.
+
+ virtual be_operation_strategy *copy (void);
+ // Overrides return a deep copy.
+
+ virtual void destroy (void);
+ // Cleanup.
protected:
-
be_operation *node_;
// The node we strategize.
@@ -82,12 +87,14 @@ class be_operation_default_strategy
public:
be_operation_default_strategy (be_operation *node);
- virtual ~be_operation_default_strategy ();
+ virtual ~be_operation_default_strategy (void);
// Overridden methods.
TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
int is_extra_state = 0);
-
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
};
@@ -108,6 +115,9 @@ public:
virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
// Returns true if we have to genrate extra code.
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
};
@@ -135,12 +145,20 @@ public:
// sendc_ operations
virtual be_operation *arguments (void);
- // returns a customized arguments list, e.g. AMI sendc_ operations
+ // Returns a customized arguments list, e.g. AMI sendc_ operations
// only use the in and inout arguments but not the out arguments,
// also the first argument is the reply handler.
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
+
+ virtual void destroy (void);
+ // Cleanup.
+
private:
be_operation *marshaling_;
be_operation *arguments_;
+ bool owns_operations_;
};
@@ -159,6 +177,9 @@ public:
TAO_CodeGen::CG_STATE current_state,
int is_extra_state = 0
);
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
};
@@ -169,7 +190,7 @@ class be_operation_amh_strategy
public:
be_operation_amh_strategy (be_operation *node);
- virtual ~be_operation_amh_strategy ();
+ virtual ~be_operation_amh_strategy (void);
// Overridden methods.
TAO_CodeGen::CG_STATE next_state (TAO_CodeGen::CG_STATE current_state,
@@ -178,6 +199,9 @@ public:
virtual int has_extra_code_generation (TAO_CodeGen::CG_STATE current_state);
virtual be_operation *arguments (void);
+
+ virtual be_operation_strategy *copy (void);
+ // Returns a deep copy.
private:
be_operation *arguments_;
diff --git a/TAO/TAO_IDL/be_include/be_root.h b/TAO/TAO_IDL/be_include/be_root.h
index b8560d5a391..c9c01113bad 100644
--- a/TAO/TAO_IDL/be_include/be_root.h
+++ b/TAO/TAO_IDL/be_include/be_root.h
@@ -43,6 +43,8 @@ public:
be_root (UTL_ScopedName *n);
// Constructor that sets its scoped name <n>, and any pragmas <p>.
+
+ virtual ~be_root (void);
// Scope management functions that override the AST scope management methods
// since the AST methods set the names of the sequences, strings, and arrays
diff --git a/TAO/TAO_IDL/be_include/be_union_branch.h b/TAO/TAO_IDL/be_include/be_union_branch.h
index 940fb93cdfe..c5de60dd2c7 100644
--- a/TAO/TAO_IDL/be_include/be_union_branch.h
+++ b/TAO/TAO_IDL/be_include/be_union_branch.h
@@ -53,6 +53,9 @@ public:
// Visiting.
virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS2 (be_union_branch, AST_UnionBranch, be_decl);
diff --git a/TAO/TAO_IDL/be_include/be_union_label.h b/TAO/TAO_IDL/be_include/be_union_label.h
index 6093f7191a8..f115041e10e 100644
--- a/TAO/TAO_IDL/be_include/be_union_label.h
+++ b/TAO/TAO_IDL/be_include/be_union_label.h
@@ -19,6 +19,9 @@ public:
// Visiting.
virtual int accept (be_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
};
#endif
diff --git a/TAO/TAO_IDL/be_include/be_valuebox.h b/TAO/TAO_IDL/be_include/be_valuebox.h
index 2ea0b53dd75..e9d485438ec 100644
--- a/TAO/TAO_IDL/be_include/be_valuebox.h
+++ b/TAO/TAO_IDL/be_include/be_valuebox.h
@@ -46,8 +46,6 @@ public:
// Narrowing
DEF_NARROW_METHODS2 (be_valuebox, AST_ValueBox, be_type);
DEF_NARROW_FROM_DECL (be_valuebox);
-
-
};
#endif /* TAO_BE_VALUEBOX_H */
diff --git a/TAO/TAO_IDL/be_include/be_visitor.h b/TAO/TAO_IDL/be_include/be_visitor.h
index c1803983b91..7f33f3ad8a1 100644
--- a/TAO/TAO_IDL/be_include/be_visitor.h
+++ b/TAO/TAO_IDL/be_include/be_visitor.h
@@ -195,7 +195,6 @@ public:
protected:
be_visitor (void);
// constructor is protected
-
};
#endif // TAO_BE_VISITOR_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
index cf4cd4a6d52..bcf8907e25e 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_ami_pre_proc.h
@@ -40,8 +40,6 @@ class be_visitor_ami_pre_proc : public be_visitor_scope
// Adds AMI implied IDL code to the AST
//
private:
- typedef AST_Interface *AST_Interface_ptr;
-
typedef enum
{
NORMAL,
@@ -116,8 +114,8 @@ private:
be_operation *generate_set_operation (be_attribute *node);
// generate a set operation out of the attribute.
- AST_Interface_ptr *create_inheritance_list (be_interface *node,
- long &n_parents);
+ AST_Interface **create_inheritance_list (be_interface *node,
+ long &n_parents);
// Create an inheritance list for the reply handler.
};
diff --git a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
index a1e5f0c6af8..c2cdc4d4cd4 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_ccm_pre_proc.h
@@ -113,10 +113,6 @@ private:
int gen_get_primary_key (be_home *node,
AST_Interface *implicit);
- // Called if there is at least one component in the IDL file, saves
- // lookup in be_global for later use by component skeleton visitors.
- int lookup_ccmobject (void);
-
// Utility functions to create and destroy the various things
// needed by operations generated from CCM-related declarations.
diff --git a/TAO/TAO_IDL/be_include/be_visitor_decl.h b/TAO/TAO_IDL/be_include/be_visitor_decl.h
index e217dbacd01..ca9132d486a 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_decl.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_decl.h
@@ -36,17 +36,17 @@ class be_visitor_decl : public be_visitor
//
public:
be_visitor_decl (be_visitor_context *ctx);
- // constructor
~be_visitor_decl (void);
- // destructor
+
+ be_visitor_context *ctx (void);
protected:
- // using a protected mechanism will allow derived visitors to access this
- // information
+ // Using a protected mechanism will allow derived visitors to access this
+ // information.
be_visitor_context *ctx_;
- // any context information required by the visitor
+ // Any context information required by the visitor.
int gen_anonymous_base_type (be_type *bt,
TAO_CodeGen::CG_STATE cg_state);
@@ -54,5 +54,4 @@ protected:
// contained by another.
};
-
#endif // TAO_BE_VISITOR_DECL_H
diff --git a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h b/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h
deleted file mode 100644
index 27d996191c1..00000000000
--- a/TAO/TAO_IDL/be_include/be_visitor_interface/remote_proxy_impl_cs.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//$Id$
-//
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// remote_proxy_impl_cs.h
-//
-// = DESCRIPTION
-// Concrete visitor for the Interface node. This
-// visitor handle the generation of the proxy
-// implementations remote clas.
-//
-// = AUTHOR
-// Angelo Corsaro <corsaro@cs.wustl.edu>
-//
-// ============================================================================
-
-#ifndef BE_REMOTE_PROXY_IMPL_CS_H_
-#define BE_REMOTE_PROXY_IMPL_CS_H_
-
-class be_visitor_interface_remote_proxy_impl_cs : public be_visitor_interface
-{
- // = TITLE
- // Generates the implementation for the remote proxy
- // implementation classes.
-
-public:
- // -- Ctor/Dtor Decl. --
- be_visitor_interface_remote_proxy_impl_cs (be_visitor_context *ctx);
-
- virtual ~be_visitor_interface_remote_proxy_impl_cs (void);
-
- virtual int visit_interface (be_interface *node);
- // visit an interface
-
- virtual int visit_component (be_component *node);
- // This will just call the above method - no need to create
- // another set of visitors for this stuff.
-
- static int gen_abstract_ops_helper (be_interface *node,
- be_interface *base,
- TAO_OutStream *os);
- // Helper to generate the declarations for the operations
- // of any abstract parents we may have.
-};
-
-#endif /* BE_REMOTE_PROXY_IMPL_CS_H_ */
diff --git a/TAO/TAO_IDL/driver/drv_args.cpp b/TAO/TAO_IDL/driver/drv_args.cpp
index aef8a8394f0..fd584c8d756 100644
--- a/TAO/TAO_IDL/driver/drv_args.cpp
+++ b/TAO/TAO_IDL/driver/drv_args.cpp
@@ -81,7 +81,7 @@ ACE_RCSID (driver,
"$Id$")
extern long DRV_nfiles;
-extern const char *DRV_files[];
+extern char *DRV_files[];
// Push a file into the list of files to be processed
void
@@ -226,18 +226,30 @@ DRV_parse_args (long ac, char **av)
ACE_TEXT ("letters not allowed\n")
));
- ACE_OS::exit (99);
+ ++i;
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ break;
case 'A':
if (av[i][2] == '\0')
{
if (i < ac - 1)
{
- i++;
- s = av[i];
+ s = av[i + 1];
+ ++i;
}
else
{
- ACE_OS::exit (99);
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: incorrect use of ")
+ ACE_TEXT ("the -A option\n")
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
}
}
else
@@ -253,8 +265,8 @@ DRV_parse_args (long ac, char **av)
if ((av[i][2] == '\0') && (i < ac - 1))
{
idl_global->append_idl_flag (av[i + 1]);
- idl_global->temp_dir (av [i + 1]);
- i++;
+ idl_global->temp_dir (av[i + 1]);
+ ++i;
}
else
{
@@ -264,9 +276,13 @@ DRV_parse_args (long ac, char **av)
ACE_TEXT (" the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
}
+
break;
case 'D':
case 'U':
@@ -276,7 +292,6 @@ DRV_parse_args (long ac, char **av)
if (i < ac - 1)
{
idl_global->append_idl_flag (av[i + 1]);
-
has_space = idl_global->hasspace (av[i + 1]);
// If the include path has a space, we need to
@@ -288,7 +303,7 @@ DRV_parse_args (long ac, char **av)
DRV_cpp_putarg (arg.c_str ());
idl_global->add_include_path (arg.substr (2).c_str ());
- i++;
+ ++i;
}
else
{
@@ -298,8 +313,12 @@ DRV_parse_args (long ac, char **av)
ACE_TEXT (" the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
}
}
else
@@ -316,6 +335,7 @@ DRV_parse_args (long ac, char **av)
idl_global->add_include_path (arg.substr (2).c_str ());
DRV_cpp_putarg (arg.c_str ());
}
+
break;
case 'E':
idl_global->set_compile_flags (idl_global->compile_flags () |
@@ -330,8 +350,8 @@ DRV_parse_args (long ac, char **av)
{
if (i < ac - 1)
{
- i++;
- s = av[i];
+ s = av[i + 1];
+ ++i;
}
else
{
@@ -341,8 +361,12 @@ DRV_parse_args (long ac, char **av)
ACE_TEXT (" the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
}
}
else
@@ -355,30 +379,38 @@ DRV_parse_args (long ac, char **av)
default:
ACE_ERROR ((
LM_ERROR,
- ACE_TEXT ("IDL: -W must be followed by 'p' or 'b'\n")
+ ACE_TEXT ("IDL: Incorrect use of -W option\n")
));
- ACE_OS::exit (99);
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
case 'p':
if (*(s + 1) == ',')
{
DRV_prep_cpp_arg (s + 2);
}
+
break;
case 'b':
if (*(s + 1) == ',')
{
be_global->prep_be_arg (s + 2);
}
+
break;
}
+
break;
case 'Y':
if (av[i][2] == '\0')
{
if (i < ac - 1)
{
- i++;
- s = av[i];
+ s = av[i + 1];
+ ++i;
}
else
{
@@ -388,8 +420,12 @@ DRV_parse_args (long ac, char **av)
ACE_TEXT (" the '%s' option\n"),
av[i]
));
-
- ACE_OS::exit (99);
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
}
}
else
@@ -405,9 +441,34 @@ DRV_parse_args (long ac, char **av)
idl_global->set_cpp_location (s + 2);
DRV_cpp_new_location (s + 2);
}
+ else
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I don't understand")
+ ACE_TEXT (" the '-Y' option\n")
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ }
+
break;
default:
- break;
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: I dont' understand the use of")
+ ACE_TEXT (" %s with the '-Y' option\n"),
+ s
+ ));
+
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
+ break;
}
break;
case 'd':
@@ -446,7 +507,10 @@ DRV_parse_args (long ac, char **av)
av[i]
));
- ACE_OS::exit (99);
+ idl_global->set_compile_flags (
+ idl_global->compile_flags ()
+ | IDL_CF_ONLY_USAGE
+ );
}
break;
@@ -504,10 +568,12 @@ DRV_parse_args (long ac, char **av)
{
ACE_ERROR ((LM_ERROR,
"%s%s\n",
- ACE_TEXT ("Error: Can't access temporary directory "),
+ ACE_TEXT ("Error: Can't access ")
+ ACE_TEXT ("temporary directory "),
tmpdir));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
}
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp
index b129e0e6068..b0b633b276f 100644
--- a/TAO/TAO_IDL/driver/drv_preproc.cpp
+++ b/TAO/TAO_IDL/driver/drv_preproc.cpp
@@ -92,9 +92,11 @@ ACE_RCSID (driver,
drv_preproc,
"$Id$")
-static long max_argcount = 128;
-static long argcount = 0;
-static const char *arglist[128];
+// Storage for preprocessor args.
+const unsigned long DRV_MAX_ARGCOUNT = 128;
+unsigned long DRV_argcount = 0;
+char *DRV_arglist[DRV_MAX_ARGCOUNT];
+
static const char *output_arg_format = 0;
static long output_arg_index = 0;
@@ -107,33 +109,34 @@ static char tmp_ifile[MAXPATHLEN + 1] = { 0 };
// Lines can be 1024 chars long intially - it will expand as required.
#define LINEBUF_SIZE 1024
-static char* drv_line = 0;
+char* drv_line = 0;
static size_t drv_line_size = LINEBUF_SIZE + 1;
// Push the new CPP location if we got a -Yp argument.
void
-DRV_cpp_new_location (const char *new_loc)
+DRV_cpp_new_location (char *new_loc)
{
- arglist[0] = new_loc;
+ DRV_arglist[0] = new_loc;
}
-// Push an argument into the arglist.
+// Push an argument into the DRV_arglist.
void
DRV_cpp_putarg (const char *str)
{
- if (argcount >= max_argcount)
+ if (DRV_argcount >= DRV_MAX_ARGCOUNT)
{
ACE_ERROR ((LM_ERROR,
"%s%s %d %s\n",
idl_global->prog_name (),
": More than",
- max_argcount,
+ DRV_MAX_ARGCOUNT,
"arguments to preprocessor"));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
- arglist[argcount++] = ACE::strnew (str);
+ DRV_arglist[DRV_argcount++] = ACE::strnew (str);
}
// Expand the output argument with the given filename.
@@ -142,8 +145,8 @@ DRV_cpp_expand_output_arg (const char *filename)
{
if (output_arg_format != 0)
{
- delete [] const_cast<char *> (arglist[output_arg_index]);
- arglist[output_arg_index] = 0;
+ delete [] const_cast<char *> (DRV_arglist[output_arg_index]);
+ DRV_arglist[output_arg_index] = 0;
char *output_arg = 0;
ACE_NEW (output_arg,
@@ -155,12 +158,12 @@ DRV_cpp_expand_output_arg (const char *filename)
output_arg_format,
filename);
- arglist[output_arg_index] = output_arg;
+ DRV_arglist[output_arg_index] = output_arg;
}
}
// Get a line from stdin.
-static long
+static bool
DRV_get_line (FILE *f)
{
char *l = fgets (drv_line,
@@ -182,10 +185,10 @@ DRV_get_line (FILE *f)
return true;
}
- while (strchr(drv_line, '\n') == NULL)
+ while (strchr (drv_line, '\n') == NULL)
{
- // Haven't got to a newline yet
- // Create a bigger buffer and keep reading
+ // Haven't got to a newline yet.
+ // Create a bigger buffer and keep reading.
size_t temp_size;
temp_size = drv_line_size * 2;
char *temp = 0;
@@ -221,7 +224,11 @@ DRV_get_line (FILE *f)
void
DRV_cpp_init (void)
{
- // Create the line buffer
+ // Create the line buffer.
+ // (JP) Deleting this at the end or DRV_pre_proc() causes
+ // Purify to output a Freeing Mismatched Memory warning.
+ // When it is not deleted (currently the case) there is no
+ // memory leak reported by Purify. I don't know why.
ACE_NEW (drv_line,
char [drv_line_size]);
@@ -240,9 +247,10 @@ DRV_cpp_init (void)
DRV_cpp_putarg (version_option);
DRV_cpp_putarg ("-I.");
- const char *cpp_args = FE_get_cpp_args_from_env ();
+
+ const char *platform_cpp_args = FE_get_cpp_args_from_env ();
- if (cpp_args == 0)
+ if (platform_cpp_args == 0)
{
// If no cpp flag was defined by the user, we define some
// platform specific flags here.
@@ -250,11 +258,11 @@ DRV_cpp_init (void)
char option2[BUFSIZ];
#if defined (TAO_IDL_PREPROCESSOR_ARGS)
- cpp_args = TAO_IDL_PREPROCESSOR_ARGS;
+ platform_cpp_args = TAO_IDL_PREPROCESSOR_ARGS;
#elif defined (ACE_CC_PREPROCESSOR_ARGS)
- cpp_args = ACE_CC_PREPROCESSOR_ARGS;
+ platform_cpp_args = ACE_CC_PREPROCESSOR_ARGS;
#else
- cpp_args = "-E";
+ platform_cpp_args = "-E";
#endif /* TAO_IDL_PREPROCESSOR_ARGS */
// So we can find OMG IDL files, such as `orb.idl'.
@@ -332,22 +340,22 @@ DRV_cpp_init (void)
idl_global->tao_root (option1 + 2);
}
- // Add any flags in cpp_args to cpp's arglist.
- ACE_ARGV arglist (cpp_args);
+ // Add any flags in platform_cpp_args to cpp's DRV_arglist.
+ ACE_ARGV platform_arglist (platform_cpp_args);
- for (size_t arg_cnt = 0; arg_cnt < (size_t)arglist.argc (); ++arg_cnt)
+ for (int i = 0; i < platform_arglist.argc (); ++i)
{
// Check for an argument that specifies the preprocessor's output file.
- if (ACE_OS::strstr (arglist[arg_cnt], "%s") != 0
+ if (ACE_OS::strstr (DRV_arglist[i], "%s") != 0
&& output_arg_format == 0)
{
- output_arg_format = ACE::strnew (arglist[arg_cnt]);
- output_arg_index = argcount;
+ output_arg_format = ACE::strnew (platform_arglist[i]);
+ output_arg_index = DRV_argcount;
DRV_cpp_putarg (0);
}
else
{
- DRV_cpp_putarg (arglist[arg_cnt]);
+ DRV_cpp_putarg (platform_arglist[i]);
}
}
}
@@ -532,7 +540,9 @@ DRV_cpp_post_init (void)
{
ACE_ERROR ((LM_ERROR,
"DRV_cpp_post_init: ACE_OS::getcwd failed\n"));
- return;
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
// If first arg is non-zero, adds an include path and filename
@@ -544,7 +554,8 @@ DRV_cpp_post_init (void)
"DRV_cpp_post_init: DRV_sweep_dirs (%s) failed\n",
idl_global->recursion_start ()));
- return;
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
// This is redundant for most backends, but not if the call to
@@ -554,6 +565,9 @@ DRV_cpp_post_init (void)
ACE_ERROR ((LM_ERROR,
"DRV_cpp_post_init: ACE_OS::chdir (%s) failed\n",
cwd_path));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
}
@@ -639,7 +653,9 @@ DRV_check_for_include (const char* buf)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("IDL: No friggin' input files\n")));
- ACE_OS::exit (99);
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
// Find the closing " or < character.
@@ -648,40 +664,36 @@ DRV_check_for_include (const char* buf)
continue;
}
- // Make a new string for this file name.
- char* file_name = 0;
- ACE_NEW (file_name,
- char [r - h + 1]);
-
- // Copy the char's.
+ // Copy the chars.
+ char incl_file[MAXPATHLEN + 1] = { 0 };
size_t fi = 0;
for (; h != r; ++fi, ++h)
{
- file_name [fi] = *h;
+ incl_file [fi] = *h;
}
// Terminate the string.
- file_name [fi] = '\0';
+ incl_file [fi] = '\0';
// Put Microsoft-style pathnames into a canonical form.
size_t i = 0;
- for (size_t j = 0; file_name [j] != '\0'; ++i, ++j)
+ for (size_t j = 0; incl_file [j] != '\0'; ++i, ++j)
{
- if (file_name [j] == '\\' && file_name [j + 1] == '\\')
+ if (incl_file [j] == '\\' && incl_file [j + 1] == '\\')
{
j++;
}
- file_name [i] = file_name [j];
+ incl_file [i] = incl_file [j];
}
// Terminate this string.
- file_name [i] = '\0';
+ incl_file [i] = '\0';
- size_t len = ACE_OS::strlen (file_name);
- ACE_CString name_str (file_name);
+ size_t len = ACE_OS::strlen (incl_file);
+ ACE_CString name_str (incl_file);
ACE_CString simple ("orb.idl");
ACE_CString nix_path ("tao/orb.idl");
ACE_CString win_path ("tao\\orb.idl");
@@ -691,7 +703,7 @@ DRV_check_for_include (const char* buf)
{
if (idl_global->pass_orb_idl ())
{
- idl_global->add_to_included_idl_files (file_name);
+ idl_global->add_to_included_idl_files (incl_file);
}
else
{
@@ -702,17 +714,17 @@ DRV_check_for_include (const char* buf)
// also kicks in for .pidl files. If one of the latter is
// included as a local name only, we add the 'tao/' prefix
// so the generated C++ include files will be correct.
- else if (ACE_OS::strcmp (file_name + len - 5, ".pidl") == 0
- && ACE_OS::strchr (file_name, '/') == 0
- && ACE_OS::strchr (file_name, '\\') == 0)
+ else if (ACE_OS::strcmp (incl_file + len - 5, ".pidl") == 0
+ && ACE_OS::strchr (incl_file, '/') == 0
+ && ACE_OS::strchr (incl_file, '\\') == 0)
{
ACE_CString fixed_name ("tao/");
- fixed_name += file_name;
+ fixed_name += incl_file;
idl_global->add_to_included_idl_files (fixed_name.rep ());
}
else
{
- idl_global->add_to_included_idl_files (file_name);
+ idl_global->add_to_included_idl_files (incl_file);
}
}
@@ -780,14 +792,14 @@ DRV_convert_includes (const char* buf)
*r = '<';
// We're not handling redirection from stdin.
- // n.b. I neither know nor care what all this is about.
- // It came free with the cut-and-paste of DRV_check_for_include. sm.
if (*r == '\0')
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("IDL: No friggin' input files\n")));
- ACE_OS::exit (99);
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
// Find the closing '"' character.
@@ -810,14 +822,17 @@ DRV_get_orb_idl_includes (void)
orb_idl_path += "/tao/orb.idl";
FILE *fd = ACE_OS::fopen (orb_idl_path.fast_rep (), "r");
- if (fd == 0) {
- ACE_ERROR ((LM_ERROR,
- "%s%s",
- orb_idl_path.fast_rep (),
- ": cannot open input file\n"));
+ if (fd == 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ "%s%s",
+ orb_idl_path.fast_rep (),
+ ": cannot open input file\n"));
- ACE_OS::exit (99);
- }
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
+ }
while (DRV_get_line (fd))
{
@@ -843,7 +858,8 @@ DRV_copy_input (FILE *fin,
idl_global->prog_name (),
fn));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
if (fin == 0)
@@ -853,7 +869,8 @@ DRV_copy_input (FILE *fin,
idl_global->prog_name (),
": cannot open input file\n"));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
#if !defined (ACE_WIN32)
@@ -957,7 +974,9 @@ DRV_pre_proc (const char *myfile)
"length allowed by platform\n",
idl_global->prog_name ()));
- return;
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
ACE_OS::strcpy (tmp_file, tmpdir);
@@ -976,7 +995,9 @@ DRV_pre_proc (const char *myfile)
"%s: Unable to create temporary file: %m\n",
idl_global->prog_name ()));
- return;
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
char tmp_cpp_file [MAXPATHLEN + 1] = { 0 };
@@ -1004,19 +1025,14 @@ DRV_pre_proc (const char *myfile)
myfile);
ACE_OS::fclose (file);
- UTL_String *tmp = 0;
- ACE_NEW (tmp,
- UTL_String (myfile));
- idl_global->set_main_filename (tmp);
+ idl_global->set_main_filename (idl_global->utl_string_factory (myfile));
ACE_Auto_String_Free safety (ACE_OS::strdup (myfile));
- ACE_NEW (tmp,
- UTL_String (DRV_stripped_name (safety.get ())));
+ UTL_String *tmp =
+ idl_global->utl_string_factory (DRV_stripped_name (safety.get ()));
idl_global->set_stripped_filename (tmp);
- ACE_NEW (tmp,
- UTL_String (t_ifile));
- idl_global->set_real_filename (tmp);
+ idl_global->set_real_filename (idl_global->utl_string_factory (t_ifile));
// We use ACE instead of the (low level) fork facilities, this also
// works on NT.
@@ -1029,9 +1045,9 @@ DRV_pre_proc (const char *myfile)
DRV_cpp_expand_output_arg (t_file);
DRV_cpp_putarg (t_ifile);
- DRV_cpp_putarg (0); // Null terminate the arglist.
+ DRV_cpp_putarg (0); // Null terminate the DRV_arglist.
- cpp_options.command_line (arglist);
+ cpp_options.command_line (DRV_arglist);
// Rename temporary files so that they have extensions accepted
// by the preprocessor. Renaming is (supposed to be) an atomic
@@ -1043,7 +1059,9 @@ DRV_pre_proc (const char *myfile)
"%s: Unable to rename temporary file: %m\n",
idl_global->prog_name ()));
- return;
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
// Remove any existing output file.
@@ -1067,7 +1085,9 @@ DRV_pre_proc (const char *myfile)
idl_global->prog_name (),
t_file));
- return;
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
cpp_options.set_handles (ACE_INVALID_HANDLE, fd);
@@ -1078,9 +1098,11 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s: spawn of \"%s\" failed\n",
idl_global->prog_name (),
- arglist[0]));
+ DRV_arglist[0]));
- return;
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
if (fd != ACE_INVALID_HANDLE)
@@ -1093,13 +1115,18 @@ DRV_pre_proc (const char *myfile)
idl_global->prog_name (),
t_file));
- return;
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
}
- // Remove the null termination and the input file from the arglist,
+ // Remove the null termination and the input file from the DRV_arglist,
// the next file will the previous args.
- argcount -= 2;
+ char *old_file = DRV_arglist[DRV_argcount - 2];
+ ACE::strdelete (old_file);
+ old_file = 0;
+ DRV_argcount -= 2;
ACE_exitcode status = 0;
@@ -1109,12 +1136,13 @@ DRV_pre_proc (const char *myfile)
"%s: wait for child process failed\n",
idl_global->prog_name ()));
- return;
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
if (WIFEXITED ((status)))
{
- // child terminated normally?
+ // Child terminated normally?
if (WEXITSTATUS ((status)) != 0)
{
errno = WEXITSTATUS ((status));
@@ -1122,22 +1150,25 @@ DRV_pre_proc (const char *myfile)
ACE_ERROR ((LM_ERROR,
"%s: preprocessor \"%s\" returned with an error\n",
idl_global->prog_name (),
- arglist[0]));
+ DRV_arglist[0]));
- ACE_OS::exit (1);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
}
else
{
- // child didn't call exit(); perhaps it received a signal?
+ // Child didn't call exit(); perhaps it received a signal?
errno = EINTR;
ACE_ERROR ((LM_ERROR,
- "%s: preprocessor \"%s\" appears to have been interrupted\n",
+ "%s: preprocessor \"%s\" appears "
+ "to have been interrupted\n",
idl_global->prog_name (),
- arglist[0]));
+ DRV_arglist[0]));
- ACE_OS::exit (1);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
// TODO: Manage problems in the pre-processor, in the previous
// version the current process would exit if the pre-processor
@@ -1152,7 +1183,8 @@ DRV_pre_proc (const char *myfile)
idl_global->prog_name (),
t_file));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
FE_set_yyin (reinterpret_cast<File *> (yyin));
@@ -1170,7 +1202,8 @@ DRV_pre_proc (const char *myfile)
idl_global->prog_name (),
t_file));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
// ACE_DEBUG sends to stderr - we want stdout for this dump
@@ -1197,7 +1230,7 @@ DRV_pre_proc (const char *myfile)
ACE_OS::fclose (preproc);
}
-
+
if (ACE_OS::unlink (t_ifile) == -1)
{
ACE_ERROR ((LM_ERROR,
@@ -1205,7 +1238,8 @@ DRV_pre_proc (const char *myfile)
idl_global->prog_name (),
t_ifile));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
#if !defined (ACE_WIN32) || defined (ACE_HAS_WINNT4) && (ACE_HAS_WINNT4 != 0)
@@ -1216,12 +1250,14 @@ DRV_pre_proc (const char *myfile)
idl_global->prog_name (),
t_file));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
#endif /* ACE_HAS_WINNT4 && ACE_HAS_WINNT4 != 0 */
if (idl_global->compile_flags () & IDL_CF_ONLY_PREPROC)
{
- ACE_OS::exit (0);
+ // Go straight to cleanup, exit normally.
+ throw FE_Bailout ();
}
}
diff --git a/TAO/TAO_IDL/fe/fe_declarator.cpp b/TAO/TAO_IDL/fe/fe_declarator.cpp
index 2492fe8d451..d2cd1dc777d 100644
--- a/TAO/TAO_IDL/fe/fe_declarator.cpp
+++ b/TAO/TAO_IDL/fe/fe_declarator.cpp
@@ -114,7 +114,7 @@ FE_Declarator::compose (AST_Decl *d)
return 0;
}
- // All uses of forward declared interfaces must
+ // All uses of forward declared types must
// not have a different prefix from the place of declaration.
if (!ct->is_defined ())
{
diff --git a/TAO/TAO_IDL/fe/fe_extern.cpp b/TAO/TAO_IDL/fe/fe_extern.cpp
index 7c1b28ad66c..64a9fb77a5f 100644
--- a/TAO/TAO_IDL/fe/fe_extern.cpp
+++ b/TAO/TAO_IDL/fe/fe_extern.cpp
@@ -88,7 +88,7 @@ FE_yyparse (void)
{
int result = tao_yyparse ();
- if (idl_global->err_count () == 0)
+ if (0 == idl_global->err_count ())
{
idl_global->root ()->call_add ();
}
diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp
index 3dff54991bd..3faee94fae4 100644
--- a/TAO/TAO_IDL/fe/fe_init.cpp
+++ b/TAO/TAO_IDL/fe/fe_init.cpp
@@ -647,7 +647,7 @@ FE_populate (void)
ACE_TEXT ("IDL: idl_global->gen() not initialized, exiting\n")
));
- ACE_OS::exit (99);
+ throw FE_Bailout ();
}
// Create a global root for the AST. Note that the AST root has no name.
@@ -663,7 +663,7 @@ FE_populate (void)
ACE_TEXT ("IDL: FE init failed to create AST root, exiting\n")
));
- ACE_OS::exit (99);
+ throw FE_Bailout ();
}
// Push it on the stack
diff --git a/TAO/TAO_IDL/fe/fe_interface_header.cpp b/TAO/TAO_IDL/fe/fe_interface_header.cpp
index 5113d78c566..b1136763ceb 100644
--- a/TAO/TAO_IDL/fe/fe_interface_header.cpp
+++ b/TAO/TAO_IDL/fe/fe_interface_header.cpp
@@ -69,12 +69,14 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// node itself is created.
#include "fe_interface_header.h"
+#include "ast_interface_fwd.h"
#include "ast_valuetype.h"
#include "ast_component.h"
#include "ast_home.h"
#include "ast_module.h"
#include "utl_namelist.h"
#include "utl_err.h"
+#include "fe_extern.h"
#include "global_extern.h"
#include "nr_extern.h"
@@ -285,14 +287,12 @@ FE_InterfaceHeader::is_abstract (void) const
void
FE_InterfaceHeader::destroy (void)
{
- if (this->pd_interface_name == 0)
+ if (0 != this->pd_interface_name)
{
- return;
+ this->pd_interface_name->destroy ();
+ delete this->pd_interface_name;
+ this->pd_interface_name = 0;
}
-
- this->pd_interface_name->destroy ();
- delete this->pd_interface_name;
- this->pd_interface_name = 0;
}
// Add this interface to the list of inherited if not already there.
@@ -371,16 +371,35 @@ FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces,
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
// Look it up.
UTL_Scope *s = idl_global->scopes ().top ();
d = s->lookup_by_name (item,
- true);
+ true,
+ true,
+ true); // full_def_only
- if (d == 0)
+ // Undefined interface?
+ if (0 == d)
+ {
+ // If the lookup now succeeds, without the full_def_only
+ // constraint, it's an error.
+ d = s->lookup_by_name (item, true, true);
+
+ if (0 != d)
+ {
+ idl_global->err ()->inheritance_fwd_error (
+ this->pd_interface_name,
+ AST_Interface::narrow_from_decl (d)
+ );
+ break;
+ }
+ }
+
+ if (0 == d)
{
AST_Decl *sad = ScopeAsDecl (s);
@@ -393,13 +412,13 @@ FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces,
}
// Not found?
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error (item);
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
// Not an appropriate interface?
@@ -426,14 +445,6 @@ FE_InterfaceHeader::compile_inheritance (UTL_NameList *ifaces,
break;
}
- // Forward declared interface?
- if (!i->is_defined ())
- {
- idl_global->err ()->inheritance_fwd_error (this->pd_interface_name,
- i);
- break;
- }
-
if (!for_valuetype && this->pd_is_abstract && !i->is_abstract ())
{
idl_global->err ()->abstract_inheritance_error (this->name (),
@@ -664,7 +675,7 @@ FE_OBVHeader::compile_supports (UTL_NameList *supports)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
// Look it up.
@@ -692,7 +703,7 @@ FE_OBVHeader::compile_supports (UTL_NameList *supports)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
// Remove typedefs, if any.
@@ -759,24 +770,28 @@ FE_OBVHeader::check_concrete_supported_inheritance (AST_Interface *d)
vt = AST_ValueType::narrow_from_decl (this->pd_inherits[i]);
concrete = vt->supports_concrete ();
- if (concrete != 0)
+ if (0 == concrete)
{
- ancestors = concrete->inherits_flat ();
- n_ancestors = concrete->n_inherits_flat ();
+ return 0;
+ }
+
+ if (d == concrete)
+ {
+ return 0;
+ }
- for (long j = 0; j < n_ancestors; ++j)
- {
- ancestor = ancestors[j];
+ for (long j = 0; j < d->n_inherits_flat (); ++j)
+ {
+ ancestor = d->inherits_flat ()[j];
- if (!d->is_child (ancestor))
- {
- return 1;
- }
+ if (ancestor == concrete)
+ {
+ return 0;
}
}
}
- return 0;
+ return 1;
}
//************************************************************************
@@ -875,7 +890,7 @@ FE_ComponentHeader::compile_inheritance (UTL_ScopedName *base_component)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
if (d->node_type () == AST_Decl::NT_typedef)
@@ -931,7 +946,7 @@ FE_ComponentHeader::compile_supports (UTL_NameList *supports)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
// Look it up.
@@ -959,7 +974,7 @@ FE_ComponentHeader::compile_supports (UTL_NameList *supports)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
// Not an appropriate interface?
@@ -1048,8 +1063,9 @@ FE_HomeHeader::FE_HomeHeader (UTL_ScopedName *n,
}
else
{
+ // No need to call compile_supports(), it got done in
+ // the call to the base class FE_ComponentHeader.
this->compile_inheritance (base_home);
- this->compile_supports (supports);
this->compile_managed_component (managed_component);
this->compile_primary_key (primary_key);
}
@@ -1095,7 +1111,7 @@ FE_HomeHeader::compile_inheritance (UTL_ScopedName *base_home)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
if (d->node_type () == AST_Decl::NT_typedef)
@@ -1130,7 +1146,7 @@ FE_HomeHeader::compile_managed_component (UTL_ScopedName *managed_component)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
if (d->node_type () == AST_Decl::NT_typedef)
@@ -1165,7 +1181,7 @@ FE_HomeHeader::compile_primary_key (UTL_ScopedName *primary_key)
// This is probably the result of bad IDL.
// We will crash if we continue from here.
- exit (99);
+ throw FE_Bailout ();
}
AST_Decl::NodeType nt = d->node_type ();
diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll
index 060223d558f..79d43f00691 100644
--- a/TAO/TAO_IDL/fe/idl.ll
+++ b/TAO/TAO_IDL/fe/idl.ll
@@ -83,6 +83,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "fe_interface_header.h"
#include "global_extern.h"
#include "fe_private.h"
+#include "fe_extern.h"
#include "nr_extern.h"
#include "y.tab.h"
@@ -180,7 +181,7 @@ oneway return IDL_ONEWAY;
\<\< return IDL_LEFT_SHIFT;
\>\> return IDL_RIGHT_SHIFT;
\:\: {
- yylval.strval = (char *) "::";
+ yylval.strval = ACE::strnew ("::");
return IDL_SCOPE_DELIMITOR;
}
@@ -207,11 +208,11 @@ oneway return IDL_ONEWAY;
if (entry)
{
- yylval.strval = ACE_OS::strdup (entry->mapping_);
+ yylval.strval = ACE::strnew (entry->mapping_);
}
else
{
- yylval.strval = ACE_OS::strdup (ace_yytext);
+ yylval.strval = ACE:strnew (ace_yytext);
}
return IDENTIFIER;
@@ -434,7 +435,8 @@ idl_parse_line_and_file (char *buf)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("IDL: No input files\n")));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
else
{
diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy
index 6f313270540..139048eb2be 100644
--- a/TAO/TAO_IDL/fe/idl.yy
+++ b/TAO/TAO_IDL/fe/idl.yy
@@ -151,7 +151,7 @@ AST_Decl *tao_enum_constant_decl = 0;
AST_Argument::Direction dival; /* Argument direction */
AST_Operation::Flags ofval; /* Operation flags */
FE_Declarator *deval; /* Declarator value */
- idl_bool bval; /* Boolean value */
+ bool bval; /* Boolean value */
long ival; /* Long value */
idl_uns_long uival; /* Unsigned long value */
double dval; /* Double value */
@@ -457,6 +457,8 @@ module : IDL_MODULE
{
// IDENTIFIER
Identifier id ($3);
+ ACE::strdelete ($3);
+ $3 = 0;
UTL_ScopedName n (&id,
0);
AST_Module *m = 0;
@@ -605,10 +607,17 @@ interface_header :
ACE_NEW_RETURN ($$,
FE_InterfaceHeader (n,
$2,
- I_FALSE,
- I_FALSE,
- I_TRUE),
+ false,
+ false,
+ true),
1);
+
+ if (0 != $2)
+ {
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
}
|
IDL_LOCAL interface_decl inheritance_spec
@@ -629,10 +638,17 @@ interface_header :
ACE_NEW_RETURN ($$,
FE_InterfaceHeader (n,
$3,
- I_TRUE,
- I_FALSE,
- I_TRUE),
+ true,
+ false,
+ true),
1);
+
+ if (0 != $3)
+ {
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
}
|
IDL_ABSTRACT interface_decl inheritance_spec
@@ -653,10 +669,17 @@ interface_header :
ACE_NEW_RETURN ($$,
FE_InterfaceHeader (n,
$3,
- I_FALSE,
- I_TRUE,
- I_TRUE),
+ false,
+ true,
+ true),
1);
+
+ if (0 != $3)
+ {
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
}
;
@@ -722,9 +745,9 @@ value_concrete_decl :
$1->supports (),
$1->n_supports (),
$1->supports_concrete (),
- I_FALSE,
+ false,
$1->truncatable (),
- I_FALSE
+ false
);
i = AST_Interface::narrow_from_decl (v);
AST_Interface::fwd_redefinition_helper (i,
@@ -800,9 +823,9 @@ value_abs_decl :
$2->supports (),
$2->n_supports (),
$2->supports_concrete (),
- I_TRUE,
- I_FALSE,
- I_FALSE
+ true,
+ false,
+ false
);
i = AST_Interface::narrow_from_decl (v);
AST_Interface::fwd_redefinition_helper (i,
@@ -861,8 +884,22 @@ value_header :
FE_OBVHeader (sn,
$2,
$4,
- $2 ? $2->truncatable () : I_FALSE),
+ $2 ? $2->truncatable () : false),
1);
+
+ if (0 != $4)
+ {
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+ }
+
+ if (0 != $2)
+ {
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+ }
}
;
@@ -884,12 +921,12 @@ opt_truncatable :
IDL_TRUNCATABLE
{
// opt_truncatable : IDL_TRUNCATABLE
- $$ = I_TRUE;
+ $$ = true;
}
| /* EMPTY */
{
/* | EMPTY */
- $$ = I_FALSE;
+ $$ = false;
}
;
@@ -925,9 +962,13 @@ value_forward_decl :
if (s != 0)
{
f = idl_global->gen ()->create_valuetype_fwd (&n,
- I_TRUE);
+ true);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
|
value_decl
@@ -946,9 +987,13 @@ value_forward_decl :
if (s != 0)
{
f = idl_global->gen ()->create_valuetype_fwd (&n,
- I_FALSE);
+ false);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
;
@@ -956,52 +1001,54 @@ value_box_decl
: value_decl type_spec /* in this order %!?*/
{
// value_box_decl : value_decl type_spec
- idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
-
- UTL_Scope *s = idl_global->scopes ().top_non_null ();
- UTL_ScopedName n ($1,
- 0);
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
- if (s != 0 && $2 != 0)
- {
- /*
- * Get the type_spec associated with the valuebox
- */
- AST_Type *tp = 0;
- AST_Typedef *td
- = AST_Typedef::narrow_from_decl ($2);
-
- if (td == 0)
- {
- tp = AST_Type::narrow_from_decl ($2);
- }
- else
- {
- tp = td->primitive_base_type ();
- }
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n ($1,
+ 0);
- if (tp == 0)
- { // The <type_spec> given is a valid type
- idl_global->err ()->not_a_type ($2);
- }
+ if (s != 0 && $2 != 0)
+ {
+ /*
+ * Get the type_spec associated with the valuebox
+ */
+ AST_Type *tp = 0;
+ AST_Typedef *td
+ = AST_Typedef::narrow_from_decl ($2);
- else if (tp->node_type() == AST_Decl::NT_valuetype)
- { // valuetype is not allowed as <type_spec> for boxed value
- idl_global->err ()->error0 (
- UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
- );
- }
+ if (td == 0)
+ {
+ tp = AST_Type::narrow_from_decl ($2);
+ }
+ else
+ {
+ tp = td->primitive_base_type ();
+ }
- else
- {
- /*
- * Add the valuebox to its definition scope
- */
- AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
- tp);
- (void) s->fe_add_valuebox (vb);
- }
- }
+ if (tp == 0)
+ { // The <type_spec> given is a valid type
+ idl_global->err ()->not_a_type ($2);
+ }
+ else if (tp->node_type() == AST_Decl::NT_valuetype)
+ { // valuetype is not allowed as <type_spec> for boxed value
+ idl_global->err ()->error0 (
+ UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
+ );
+ }
+ else
+ {
+ /*
+ * Add the valuebox to its definition scope
+ */
+ AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
+ tp);
+ (void) s->fe_add_valuebox (vb);
+ }
+ }
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
;
@@ -1196,6 +1243,8 @@ scoped_name
ACE_NEW_RETURN (id,
Identifier ($1),
1);
+ ACE::strdelete ($1);
+ $1 = 0;
UTL_IdList *sn = 0;
ACE_NEW_RETURN (sn,
UTL_IdList ($3,
@@ -1211,6 +1260,12 @@ scoped_name
{
// | scoped_name IDL_SCOPE_DELIMITOR
idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
+
+ // This cleans up all the non-global "::"s in scoped names.
+ // If there is a global one, it gets put into the UTL_IdList,
+ // so we clean it up in the case above.
+ ACE::strdelete ($2);
+ $2 = 0;
}
id
{
@@ -1233,7 +1288,8 @@ id : IDENTIFIER
ACE_NEW_RETURN ($$,
Identifier ($1),
1);
- ACE_OS::free ($1);
+ ACE::strdelete ($1);
+ $1 = 0;
}
;
@@ -1256,6 +1312,11 @@ interface_forward :
);
(void) s->add_predefined_type (pdt);
s->add_to_scope (pdt);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+
break;
}
@@ -1273,6 +1334,10 @@ interface_forward :
0);
(void) s->fe_add_interface_fwd (f);
}
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
|
IDL_LOCAL interface_decl
@@ -1297,6 +1362,10 @@ interface_forward :
0);
(void) s->fe_add_interface_fwd (f);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
|
IDL_ABSTRACT interface_decl
@@ -1321,6 +1390,10 @@ interface_forward :
1);
(void) s->fe_add_interface_fwd (f);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
;
@@ -1369,6 +1442,9 @@ const_dcl :
{
idl_global->err ()->coercion_error ($9,
$3);
+ $9->destroy ();
+ delete $9;
+ $9 = 0;
}
else
{
@@ -1380,6 +1456,7 @@ const_dcl :
);
(void) s->fe_add_constant (c);
delete result;
+ result = 0;
}
$5->destroy ();
@@ -1426,7 +1503,11 @@ const_type
*/
AST_Decl *d =
s->lookup_by_name ($1,
- I_TRUE);
+ true);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
if (s != 0 && d != 0)
{
@@ -1658,7 +1739,7 @@ primary_expr
*/
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name ($1,
- I_TRUE);
+ true);
/*
* If the scoped name is an IDL constant, it may be used in an
@@ -1670,8 +1751,13 @@ primary_expr
if (d != 0 && d->node_type () == AST_Decl::NT_const)
{
AST_Constant *c = AST_Constant::narrow_from_decl (d);
- $$ = idl_global->gen ()->create_expr (c->constant_value (),
- c->et ());
+ $$ =
+ idl_global->gen ()->create_expr (c->constant_value (),
+ c->et ());
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
else
{
@@ -1704,6 +1790,9 @@ literal
{
// | IDL_STRING_LITERAL
$$ = idl_global->gen ()->create_expr ($1);
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
| IDL_WSTRING_LITERAL
{
@@ -1800,9 +1889,7 @@ positive_int_expr :
if (good_expression)
{
- $$ =
- idl_global->gen()->create_expr ($1,
- AST_Expression::EV_ulong);
+ $$ = $1;
}
else
{
@@ -1859,6 +1946,10 @@ type_dcl
*/
(void) s->fe_add_native (node);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
| constructed_forward_type_spec
{
@@ -1905,6 +1996,12 @@ type_declarator :
continue;
}
+ if (AST_Decl::NT_except == tp->node_type ())
+ {
+ idl_global->err ()->not_a_type (tp);
+ continue;
+ }
+
t = idl_global->gen ()->create_typedef (tp,
d->name (),
s->is_local (),
@@ -1945,7 +2042,7 @@ simple_type_spec
if (s != 0)
{
d = s->lookup_by_name ($1,
- I_TRUE);
+ true);
}
if (d == 0)
@@ -2290,6 +2387,10 @@ struct_type
* Push the scope of the struct on the scopes stack.
*/
idl_global->scopes ().push (d);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
'{'
{
@@ -2396,6 +2497,10 @@ member_i :
(void) s->fe_add_field (f);
}
}
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
| error
{
@@ -2482,6 +2587,10 @@ union_type
* Push the scope of the union on the scopes stack
*/
idl_global->scopes ().push (u);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
'{'
{
@@ -2562,7 +2671,7 @@ switch_type_spec :
AST_Decl *d = 0;
AST_PredefinedType *p = 0;
AST_Typedef *t = 0;
- idl_bool found = I_FALSE;
+ bool found = false;
/*
* The discriminator is a scoped name. Try to resolve to
@@ -2571,7 +2680,7 @@ switch_type_spec :
* chain.
*/
d = s->lookup_by_name ($1,
- I_TRUE);
+ true);
if (s != 0 && d != 0)
{
@@ -2581,7 +2690,7 @@ switch_type_spec :
{
case AST_Decl::NT_enum:
$$ = d;
- found = I_TRUE;
+ found = true;
break;
case AST_Decl::NT_pre_defined:
p = AST_PredefinedType::narrow_from_decl (d);
@@ -2599,7 +2708,7 @@ switch_type_spec :
case AST_PredefinedType::PT_char:
case AST_PredefinedType::PT_boolean:
$$ = p;
- found = I_TRUE;
+ found = true;
break;
case AST_PredefinedType::PT_wchar:
case AST_PredefinedType::PT_octet:
@@ -2608,18 +2717,18 @@ switch_type_spec :
UTL_Error::EIDL_DISC_TYPE
);
$$ = 0;
- found = I_TRUE;
+ found = true;
break;
default:
$$ = 0;
- found = I_TRUE;
+ found = true;
break;
}
}
else
{
$$ = 0;
- found = I_TRUE;
+ found = true;
}
break;
@@ -2634,7 +2743,7 @@ switch_type_spec :
break;
default:
$$ = 0;
- found = I_TRUE;
+ found = true;
break;
}
}
@@ -2647,10 +2756,18 @@ switch_type_spec :
if ($$ == 0)
{
idl_global->err ()->lookup_error ($1);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
/* If we don't return here, we'll crash later.*/
return 1;
}
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
;
@@ -2695,6 +2812,12 @@ case_branch :
f->name ()
);
(void) s->fe_add_union_branch (b);
+
+ // f has passed its field type to the union branch,
+ // but the rest still needs to be cleaned up.
+ f->AST_Decl::destroy ();
+ delete f;
+ f = 0;
}
}
| error
@@ -2832,6 +2955,10 @@ element_spec :
$3->name ()
);
}
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
}
;
@@ -2853,6 +2980,10 @@ struct_forward_type
d = idl_global->gen ()->create_structure_fwd (&n);
(void) s->fe_add_structure_fwd (d);
}
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
;
@@ -2873,6 +3004,10 @@ union_forward_type
u = idl_global->gen ()->create_union_fwd (&n);
(void) s->fe_add_union_fwd (u);
}
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
;
@@ -2887,7 +3022,7 @@ enum_type :
// id
UTL_Scope *s = idl_global->scopes ().top_non_null ();
UTL_ScopedName n ($3,
- 0);
+ 0);
AST_Enum *e = 0;
idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen);
@@ -2910,6 +3045,10 @@ enum_type :
* Push the enum scope on the scopes stack.
*/
idl_global->scopes ().push (e);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
'{'
{
@@ -2962,6 +3101,8 @@ enumerator :
// enumerator : IDENTIFIER
UTL_Scope *s = idl_global->scopes ().top_non_null ();
Identifier id ($1);
+ ACE::strdelete ($1);
+ $1 = 0;
UTL_ScopedName n (&id,
0);
AST_EnumVal *e = 0;
@@ -3019,13 +3160,20 @@ sequence_type_spec
/*
* Create a node representing a sequence
*/
- if ($4 == 0 || $4->coerce (AST_Expression::EV_ulong) == 0)
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if ($4 != 0)
+ {
+ ev = $4->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == $4 || 0 == ev)
{
idl_global->err ()->coercion_error ($4,
AST_Expression::EV_ulong);
$$ = 0;
}
- else if ($1 == 0)
+ else if (0 == $1)
{
$$ = 0;
}
@@ -3033,7 +3181,7 @@ sequence_type_spec
{
AST_Type *tp = AST_Type::narrow_from_decl ($1);
- if (tp == 0)
+ if (0 == tp)
{
; // Error will be caught in FE_Declarator.
}
@@ -3053,6 +3201,9 @@ sequence_type_spec
);
}
}
+
+ delete ev;
+ ev = 0;
}
| seq_head
'>'
@@ -3151,8 +3302,14 @@ string_type_spec
/*
* Create a node representing a string.
*/
- if ($4 == 0
- || $4->coerce (AST_Expression::EV_ulong) == 0)
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if ($4 != 0)
+ {
+ ev = $4->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == $4 || 0 == ev)
{
idl_global->err ()->coercion_error ($4,
AST_Expression::EV_ulong);
@@ -3170,6 +3327,9 @@ string_type_spec
)
);
}
+
+ delete ev;
+ ev = 0;
}
| string_head
{
@@ -3296,6 +3456,12 @@ array_declarator :
0,
0
);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ sn.destroy ();
}
}
;
@@ -3360,8 +3526,14 @@ array_dim :
* Array dimensions are expressions which must be coerced to
* positive integers.
*/
- if ($3 == 0
- || $3->coerce (AST_Expression::EV_ulong) == 0)
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if ($3 != 0)
+ {
+ ev = $3->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == $3 || 0 == ev)
{
idl_global->err ()->coercion_error ($3,
AST_Expression::EV_ulong);
@@ -3371,6 +3543,9 @@ array_dim :
{
$$ = $3;
}
+
+ delete ev;
+ ev = 0;
}
;
@@ -3437,9 +3612,9 @@ attribute_readonly :
a =
idl_global->gen ()->create_attribute (
- I_TRUE,
+ true,
tp,
- (UTL_IdList *) d->name ()->copy (),
+ d->name (),
s->is_local (),
s->is_abstract ()
);
@@ -3447,11 +3622,19 @@ attribute_readonly :
if ($9 != 0)
{
(void) a->fe_add_get_exceptions ($9);
+
+ $9->destroy ();
+ delete $9;
+ $9 = 0;
}
(void) s->fe_add_attribute (a);
}
}
+
+ $7->destroy ();
+ delete $7;
+ $7 = 0;
}
;
@@ -3513,9 +3696,9 @@ attribute_readwrite :
a =
idl_global->gen ()->create_attribute (
- I_FALSE,
+ false,
tp,
- (UTL_IdList *) d->name ()->copy (),
+ d->name (),
s->is_local (),
s->is_abstract ()
);
@@ -3523,16 +3706,28 @@ attribute_readwrite :
if ($7 != 0)
{
(void) a->fe_add_get_exceptions ($7);
+
+ $7->destroy ();
+ delete $7;
+ $7 = 0;
}
if ($9 != 0)
{
(void) a->fe_add_set_exceptions ($9);
+
+ $9->destroy ();
+ delete $9;
+ $9 = 0;
}
(void) s->fe_add_attribute (a);
}
}
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
}
;
@@ -3567,6 +3762,10 @@ exception :
* Push the exception scope on the scope stack.
*/
idl_global->scopes ().push (e);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
'{'
{
@@ -3601,6 +3800,9 @@ operation :
// IDENTIFIER
UTL_Scope *s = idl_global->scopes ().top_non_null ();
Identifier id ($4);
+ ACE::strdelete ($4);
+ $4 = 0;
+
UTL_ScopedName n (&id,
0);
AST_Operation *o = 0;
@@ -3627,7 +3829,7 @@ operation :
{
AST_Decl *d = ScopeAsDecl (s);
AST_Decl::NodeType nt = d->node_type ();
- idl_bool local =
+ bool local =
s->is_local ()
|| nt == AST_Decl::NT_valuetype
|| nt == AST_Decl::NT_eventtype;
@@ -3641,9 +3843,6 @@ operation :
}
}
- ACE_OS::free ($4);
- $4 = 0;
-
/*
* Push the operation scope onto the scopes stack.
*/
@@ -3744,9 +3943,14 @@ init_decl
ACE_TEXT ("factory construct.\n"),
idl_global->filename ()->get_string (),
idl_global->lineno ()));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
}
Identifier id ($3);
+ ACE::strdelete ($3);
+ $3 = 0;
+
UTL_ScopedName n (&id,
0);
AST_Factory *factory = 0;
@@ -3858,12 +4062,16 @@ in_parameter :
a = idl_global->gen ()->create_argument (
AST_Argument::dir_IN,
tp,
- (UTL_IdList *) $5->name ()->copy ()
+ $5->name ()
);
(void) s->fe_add_argument (a);
}
}
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
}
;
@@ -3944,12 +4152,16 @@ parameter :
idl_global->gen ()->create_argument (
$1,
tp,
- (UTL_IdList *) $5->name ()->copy ()
+ $5->name ()
);
(void) s->fe_add_argument (a);
}
}
}
+
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
}
;
@@ -3975,7 +4187,7 @@ param_type_spec
if (s != 0)
{
d = s->lookup_by_name ($1,
- I_TRUE);
+ true);
}
if (d == 0)
@@ -4129,9 +4341,9 @@ at_least_one_string_literal :
{
// at_least_one_string_literal : IDL_STRING_LITERAL string_literals
ACE_NEW_RETURN ($$,
- UTL_StrList ($1,
- $2),
- 1);
+ UTL_StrList ($1,
+ $2),
+ 1);
}
;
@@ -4176,7 +4388,7 @@ typeid_dcl
// typeid_dcl : IDL_TYPEID scoped_name IDL_STRING_LITERAL
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name ($2,
- I_TRUE);
+ true);
if (d == 0)
{
@@ -4188,6 +4400,14 @@ typeid_dcl
$3->get_string ()
);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
;
@@ -4205,7 +4425,7 @@ typeprefix_dcl
if (d->name ()->compare ($2) != 0)
{
d = s->lookup_by_name ($2,
- I_TRUE);
+ true);
}
if (d == 0)
@@ -4218,6 +4438,14 @@ typeprefix_dcl
$3->get_string ()
);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
;
@@ -4248,6 +4476,10 @@ component_forward_decl :
f = idl_global->gen ()->create_component_fwd (&n);
(void) s->fe_add_component_fwd (f);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
;
@@ -4343,8 +4575,22 @@ component_header :
FE_ComponentHeader (n,
$4,
$6,
- I_FALSE),
+ false),
1);
+
+ if (0 != $6)
+ {
+ $6->destroy ();
+ delete $6;
+ $6 = 0;
+ }
+
+ if (0 != $4)
+ {
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+ }
}
;
@@ -4445,11 +4691,20 @@ provides_decl :
if (c != 0)
{
- AST_Decl *d = s->lookup_by_name (yyvsp[-1].idlist,
- I_TRUE);
- if (d == 0)
+ AST_Decl *d = s->lookup_by_name ($2,
+ true);
+ if (0 == d)
{
- idl_global->err ()->lookup_error (yyvsp[-1].idlist);
+ idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
break;
}
else if (d->node_type () != AST_Decl::NT_interface)
@@ -4461,17 +4716,31 @@ provides_decl :
!= 0)
{
idl_global->err ()->interface_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
break;
}
}
+
AST_Type *interface_type =
AST_Type::narrow_from_decl (d);
AST_Component::port_description pd;
- pd.id = yyvsp[0].idval;
+ pd.id = $3;
pd.impl = interface_type;
c->provides ().enqueue_tail (pd);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
;
@@ -4479,19 +4748,8 @@ interface_type
: scoped_name
{
// interface_type : scoped_name
- UTL_Scope *s = idl_global->scopes ().top_non_null ();
- AST_Decl *d = s->lookup_by_name ($1,
- I_TRUE);
-
- if (d == 0)
- {
- idl_global->err ()->lookup_error ($1);
- }
- else if (d->node_type () != AST_Decl::NT_interface)
- {
- idl_global->err ()->interface_expected (d);
- }
-
+ // Lookups and checking are done where the 'interface_type'
+ // token is used, in 'provides_decl' and 'uses_decl'.
$$ = $1;
}
| IDL_OBJECT
@@ -4527,11 +4785,20 @@ uses_decl :
// uses_decl : IDL_USES opt_multiple interface_type id
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name ($3,
- I_TRUE);
+ true);
- if (d == 0)
+ if (0 == d)
{
- idl_global->err ()->lookup_error (yyvsp[-1].idlist);
+ idl_global->err ()->lookup_error ($3);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+
break;
}
else if (d->node_type () != AST_Decl::NT_interface)
@@ -4541,6 +4808,15 @@ uses_decl :
!= 0)
{
idl_global->err ()->interface_expected (d);
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ $4->destroy ();
+ delete $4;
+ $4 = 0;
+
break;
}
}
@@ -4556,7 +4832,7 @@ uses_decl :
ud.is_multiple = $2;
c->uses ().enqueue_tail (ud);
- if (ud.is_multiple == I_TRUE
+ if (ud.is_multiple == true
&& !idl_global->using_ifr_backend ()
&& !idl_global->ignore_idl3 ())
{
@@ -4566,6 +4842,10 @@ uses_decl :
idl_global->create_uses_multiple_stuff (c, ud);
}
}
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
;
@@ -4573,12 +4853,12 @@ opt_multiple
: IDL_MULTIPLE
{
// opt_multiple : IDL_MULTIPLE
- $$ = I_TRUE;
+ $$ = true;
}
| /* EMPTY */
{
/* | EMPTY */
- $$ = I_FALSE;
+ $$ = false;
}
;
@@ -4590,15 +4870,35 @@ emits_decl :
// emits_decl : IDL_EMITS scoped_name id
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name ($2,
- I_TRUE);
+ true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
}
else if (d->node_type () != AST_Decl::NT_eventtype)
{
idl_global->err ()->eventtype_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
}
else
{
@@ -4613,6 +4913,10 @@ emits_decl :
c->emits ().enqueue_tail (pd);
}
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
;
@@ -4624,15 +4928,35 @@ publishes_decl :
// publishes_decl : IDL_PUBLISHES scoped_name id
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name ($2,
- I_TRUE);
+ true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
}
else if (d->node_type () != AST_Decl::NT_eventtype)
{
idl_global->err ()->eventtype_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
}
else
{
@@ -4647,6 +4971,10 @@ publishes_decl :
c->publishes ().enqueue_tail (pd);
}
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
;
@@ -4658,15 +4986,35 @@ consumes_decl :
// consumes_decl : IDL_CONSUMES scoped_name id
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name ($2,
- I_TRUE);
+ true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error ($2);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
}
else if (d->node_type () != AST_Decl::NT_eventtype)
{
idl_global->err ()->eventtype_expected (d);
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+
+ break;
}
else
{
@@ -4681,6 +5029,10 @@ consumes_decl :
c->consumes ().enqueue_tail (pd);
}
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
;
@@ -4784,6 +5136,31 @@ home_header :
$11,
$13),
1);
+
+ $11->destroy ();
+ delete $11;
+ $11 = 0;
+
+ if (0 != $5)
+ {
+ $5->destroy ();
+ delete $5;
+ $5 = 0;
+ }
+
+ if (0 != $13)
+ {
+ $13->destroy ();
+ delete $13;
+ $13 = 0;
+ }
+
+ if (0 != $7)
+ {
+ $7->destroy ();
+ delete $7;
+ $7 = 0;
+ }
}
;
@@ -4889,14 +5266,15 @@ factory_decl :
home->managed_component (),
AST_Operation::OP_noflags,
&n,
- I_FALSE,
- I_FALSE
+ false,
+ false
);
home->factories ().enqueue_tail (o);
}
- delete $2;
- $2 = 0;
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
/*
* Push the operation scope onto the scopes stack.
@@ -4958,14 +5336,15 @@ finder_decl :
home->managed_component (),
AST_Operation::OP_noflags,
&n,
- I_FALSE,
- I_FALSE
+ false,
+ false
);
home->finders ().enqueue_tail (o);
}
- delete $2;
- $2 = 0;
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
/*
* Push the operation scope onto the scopes stack.
@@ -5033,9 +5412,13 @@ event_concrete_forward_decl :
if (s != 0)
{
f = idl_global->gen ()->create_eventtype_fwd (&n,
- I_FALSE);
+ false);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ $2->destroy ();
+ delete $2;
+ $2 = 0;
}
;
@@ -5058,9 +5441,13 @@ event_abs_forward_decl :
if (s != 0)
{
f = idl_global->gen ()->create_eventtype_fwd (&n,
- I_TRUE);
+ true);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
}
;
@@ -5088,9 +5475,9 @@ event_abs_decl :
$2->supports (),
$2->n_supports (),
$2->supports_concrete (),
- I_TRUE,
- I_FALSE,
- I_FALSE
+ true,
+ false,
+ false
);
i = AST_Interface::narrow_from_decl (e);
AST_Interface::fwd_redefinition_helper (i,
@@ -5106,6 +5493,10 @@ event_abs_decl :
* Push it on the scope stack.
*/
idl_global->scopes ().push (e);
+
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
}
'{'
{
@@ -5144,7 +5535,7 @@ event_custom_header :
IDL_EVENTTYPE
id
{
-// id
+// event_custom_header : IDL_CUSTOM IDL_EVENTTYPE id
idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
ACE_DEBUG ((LM_DEBUG,
@@ -5162,7 +5553,7 @@ event_plain_header :
IDL_EVENTTYPE
id
{
-// id
+// event_plain_header : IDL_EVENTTYPE id
idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
$$ = $2;
@@ -5181,11 +5572,29 @@ event_rest_of_header :
idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
ACE_NEW_RETURN ($$,
- FE_EventHeader (0,
- $1,
- $3,
- $1 ? $1->truncatable () : I_FALSE),
+ FE_EventHeader (
+ 0,
+ $1,
+ $3,
+ $1
+ ? $1->truncatable ()
+ : false
+ ),
1);
+
+ if (0 != $3)
+ {
+ $3->destroy ();
+ delete $3;
+ $3 = 0;
+ }
+
+ if (0 != $1)
+ {
+ $1->destroy ();
+ delete $1;
+ $1 = 0;
+ }
}
;
@@ -5200,6 +5609,8 @@ event_decl :
if (s != 0 && $1 != 0)
{
+ // We create the scoped name here instead of with the
+ // FE_EventHeader because there is a token for it only here.
UTL_ScopedName sn ($1,
0);
e =
@@ -5213,9 +5624,9 @@ event_decl :
$2->supports (),
$2->n_supports (),
$2->supports_concrete (),
- I_FALSE,
+ false,
$2->truncatable (),
- I_FALSE
+ false
);
i = AST_Interface::narrow_from_decl (e);
AST_Interface::fwd_redefinition_helper (i,
@@ -5230,6 +5641,8 @@ event_decl :
$2->destroy ();
delete $2;
$2 = 0;
+
+ sn.destroy ();
}
/*
diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp
index 09ff7d3add0..0107c500285 100644
--- a/TAO/TAO_IDL/fe/lex.yy.cpp
+++ b/TAO/TAO_IDL/fe/lex.yy.cpp
@@ -890,6 +890,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "fe_interface_header.h"
#include "global_extern.h"
#include "fe_private.h"
+#include "fe_extern.h"
#include "nr_extern.h"
#include "y.tab.h"
@@ -1413,7 +1414,7 @@ return IDL_RIGHT_SHIFT;
case 67:
TAO_YY_RULE_SETUP
{
- tao_yylval.strval = (char *) "::";
+ tao_yylval.strval = ACE::strnew ("::");
return IDL_SCOPE_DELIMITOR;
}
TAO_YY_BREAK
@@ -1442,11 +1443,11 @@ TAO_YY_RULE_SETUP
if (entry)
{
- tao_yylval.strval = ACE_OS::strdup (entry->mapping_);
+ tao_yylval.strval = ACE::strnew (entry->mapping_);
}
else
{
- tao_yylval.strval = ACE_OS::strdup (ace_tao_yytext);
+ tao_yylval.strval = ACE::strnew (ace_tao_yytext);
}
return IDENTIFIER;
@@ -2637,7 +2638,8 @@ idl_parse_line_and_file (char *buf)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("IDL: No input files\n")));
- ACE_OS::exit (99);
+ idl_global->set_err_count (idl_global->err_count () + 1);
+ throw FE_Bailout ();
}
else
{
@@ -2791,12 +2793,18 @@ idl_store_pragma (char *buf)
top_scope->has_prefix (true);
}
- ACE_CString ext_id;
- ext_id.set (idl_global->filename ()->get_string (),
- 0);
- char *int_id = ACE::strnew (new_prefix);
- (void) idl_global->file_prefixes ().rebind (ext_id,
- int_id);
+ char *ext_id = idl_global->filename ()->get_string ();
+ char *int_id = 0;
+ int status = idl_global->file_prefixes ().find (ext_id,
+ int_id);
+
+ if (status != 0)
+ {
+ ext_id = ACE::strnew (ext_id);
+ int_id = ACE::strnew (new_prefix);
+ (void) idl_global->file_prefixes ().bind (ext_id,
+ int_id);
+ }
}
}
else if (ACE_OS::strncmp (buf + 8, "version", 7) == 0)
@@ -3282,10 +3290,11 @@ idl_find_node (char *s)
if (d == 0)
{
idl_global->err ()->lookup_error (node);
- node->destroy ();
- delete node;
- node = 0;
}
+
+ node->destroy ();
+ delete node;
+ node = 0;
return d;
}
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp
index 6acb820bfa3..60469041f98 100644
--- a/TAO/TAO_IDL/fe/y.tab.cpp
+++ b/TAO/TAO_IDL/fe/y.tab.cpp
@@ -2,7 +2,7 @@
/* A Bison parser, made by GNU Bison 1.875d. */
/* Skeleton parser for Yacc-like parsing with Bison,
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -306,7 +306,7 @@ typedef union TAO_YYSTYPE {
AST_Argument::Direction dival; /* Argument direction */
AST_Operation::Flags ofval; /* Operation flags */
FE_Declarator *deval; /* Declarator value */
- bool bval; /* Boolean value */
+ bool bval; /* Boolean value */
long ival; /* Long value */
idl_uns_long uival; /* Unsigned long value */
double dval; /* Double value */
@@ -336,13 +336,6 @@ typedef union TAO_YYSTYPE {
#if ! defined (tao_yyoverflow) || TAO_YYERROR_VERBOSE
-# ifndef TAO_YYFREE
-# define TAO_YYFREE free
-# endif
-# ifndef TAO_YYMALLOC
-# define TAO_YYMALLOC malloc
-# endif
-
/* The parser invokes alloca or malloc; define the necessary symbols. */
# ifdef TAO_YYSTACK_USE_ALLOCA
@@ -367,8 +360,8 @@ typedef union TAO_YYSTYPE {
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# define TAO_YYSIZE_T size_t
# endif
-# define TAO_YYSTACK_ALLOC TAO_YYMALLOC
-# define TAO_YYSTACK_FREE TAO_YYFREE
+# define TAO_YYSTACK_ALLOC malloc
+# define TAO_YYSTACK_FREE free
# endif
#endif /* ! defined (tao_yyoverflow) || TAO_YYERROR_VERBOSE */
@@ -380,7 +373,7 @@ typedef union TAO_YYSTYPE {
/* A type that is properly aligned for any stack member. */
union tao_yyalloc
{
- short int tao_yyss;
+ short tao_yyss;
TAO_YYSTYPE tao_yyvs;
};
@@ -390,7 +383,7 @@ union tao_yyalloc
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define TAO_YYSTACK_BYTES(N) \
- ((N) * (sizeof (short int) + sizeof (TAO_YYSTYPE)) \
+ ((N) * (sizeof (short) + sizeof (TAO_YYSTYPE)) \
+ TAO_YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
@@ -432,7 +425,7 @@ union tao_yyalloc
#if defined (__STDC__) || defined (__cplusplus)
typedef signed char tao_yysigned_char;
#else
- typedef short int tao_yysigned_char;
+ typedef short tao_yysigned_char;
#endif
/* TAO_YYFINAL -- State number of the termination state. */
@@ -498,7 +491,7 @@ static const unsigned char tao_yytranslate[] =
#if TAO_YYDEBUG
/* TAO_YYPRHS[TAO_YYN] -- Index of the first RHS symbol of rule number TAO_YYN in
TAO_YYRHS. */
-static const unsigned short int tao_yyprhs[] =
+static const unsigned short tao_yyprhs[] =
{
0, 0, 3, 5, 8, 9, 10, 14, 15, 19,
20, 24, 25, 29, 30, 34, 35, 39, 40, 44,
@@ -551,7 +544,7 @@ static const unsigned short int tao_yyprhs[] =
};
/* TAO_YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const short int tao_yyrhs[] =
+static const short tao_yyrhs[] =
{
101, 0, -1, 102, -1, 102, 103, -1, -1, -1,
190, 104, 79, -1, -1, 351, 105, 79, -1, -1,
@@ -677,56 +670,56 @@ static const short int tao_yyrhs[] =
};
/* TAO_YYRLINE[TAO_YYN] -- source line where rule number TAO_YYN was defined. */
-static const unsigned short int tao_yyrline[] =
+static const unsigned short tao_yyrline[] =
{
0, 320, 320, 323, 324, 329, 328, 339, 338, 349,
348, 359, 358, 369, 368, 379, 378, 389, 388, 399,
398, 409, 408, 419, 418, 429, 428, 439, 438, 452,
- 457, 481, 486, 451, 502, 503, 508, 547, 552, 507,
- 570, 569, 583, 614, 638, 665, 664, 676, 683, 684,
- 685, 686, 690, 701, 706, 750, 755, 705, 784, 823,
- 828, 782, 847, 845, 882, 881, 895, 901, 908, 915,
- 922, 944, 967, 1020, 1021, 1025, 1026, 1027, 1033, 1032,
- 1040, 1039, 1049, 1050, 1055, 1054, 1065, 1064, 1075, 1074,
- 1085, 1084, 1095, 1094, 1105, 1104, 1115, 1114, 1125, 1124,
- 1138, 1151, 1149, 1179, 1186, 1197, 1196, 1222, 1220, 1241,
- 1252, 1289, 1313, 1340, 1345, 1350, 1355, 1339, 1404, 1405,
- 1406, 1407, 1408, 1409, 1410, 1422, 1427, 1498, 1500, 1502,
- 1503, 1517, 1518, 1532, 1533, 1546, 1547, 1557, 1570, 1571,
- 1581, 1594, 1595, 1605, 1615, 1628, 1629, 1639, 1649, 1662,
- 1692, 1693, 1702, 1707, 1714, 1719, 1724, 1729, 1735, 1740,
- 1746, 1755, 1829, 1828, 1838, 1843, 1848, 1853, 1876, 1885,
- 1884, 1937, 1938, 1942, 1950, 1951, 1979, 1980, 1981, 1982,
- 1983, 1984, 1985, 1986, 1990, 1991, 1992, 1996, 1997, 1998,
- 2002, 2003, 2007, 2020, 2018, 2048, 2055, 2056, 2060, 2073,
- 2071, 2101, 2108, 2125, 2144, 2145, 2149, 2154, 2159, 2167,
- 2172, 2177, 2185, 2190, 2195, 2203, 2217, 2222, 2230, 2238,
- 2246, 2254, 2263, 2262, 2278, 2308, 2313, 2277, 2332, 2335,
- 2336, 2340, 2340, 2350, 2355, 2349, 2414, 2413, 2428, 2427,
- 2442, 2447, 2452, 2457, 2500, 2505, 2441, 2529, 2537, 2551,
- 2561, 2569, 2570, 2667, 2670, 2671, 2676, 2681, 2675, 2711,
- 2710, 2724, 2735, 2757, 2765, 2764, 2780, 2785, 2779, 2802,
- 2801, 2850, 2870, 2891, 2896, 2925, 2930, 2890, 2956, 2961,
- 2959, 2966, 2970, 3005, 3010, 3003, 3067, 3122, 3132, 3121,
- 3147, 3152, 3145, 3184, 3208, 3218, 3223, 3216, 3253, 3276,
- 3285, 3284, 3314, 3325, 3347, 3355, 3360, 3354, 3388, 3389,
- 3394, 3399, 3404, 3409, 3393, 3470, 3475, 3480, 3485, 3469,
- 3551, 3556, 3582, 3587, 3550, 3605, 3610, 3663, 3668, 3603,
- 3705, 3711, 3718, 3725, 3726, 3738, 3744, 3781, 3737, 3803,
- 3802, 3813, 3812, 3825, 3830, 3828, 3835, 3840, 3845, 3839,
- 3882, 3881, 3892, 3891, 3904, 3909, 3907, 3914, 3919, 3924,
- 3918, 3967, 3975, 3976, 3977, 4020, 4025, 4030, 4039, 4044,
- 4038, 4056, 4064, 4069, 4063, 4081, 4089, 4094, 4088, 4106,
- 4114, 4119, 4113, 4131, 4138, 4151, 4149, 4177, 4184, 4205,
- 4235, 4236, 4240, 4266, 4306, 4311, 4265, 4330, 4335, 4328,
- 4363, 4362, 4373, 4380, 4381, 4386, 4385, 4396, 4395, 4406,
- 4405, 4416, 4415, 4426, 4425, 4436, 4435, 4448, 4489, 4507,
- 4532, 4583, 4589, 4596, 4630, 4664, 4699, 4698, 4748, 4753,
- 4758, 4763, 4768, 4773, 4747, 4802, 4801, 4812, 4819, 4826,
- 4834, 4839, 4833, 4851, 4852, 4856, 4858, 4857, 4868, 4867,
- 4882, 4917, 4880, 4951, 4986, 4949, 5018, 5019, 5020, 5024,
- 5025, 5029, 5053, 5080, 5121, 5126, 5078, 5143, 5153, 5172,
- 5184, 5183, 5216, 5262, 5267, 5214, 5284, 5289
+ 457, 483, 488, 451, 504, 505, 510, 549, 554, 509,
+ 572, 571, 585, 623, 654, 688, 687, 699, 706, 707,
+ 708, 709, 713, 724, 729, 773, 778, 728, 807, 846,
+ 851, 805, 870, 868, 919, 918, 932, 938, 945, 952,
+ 959, 985, 1012, 1067, 1068, 1072, 1073, 1074, 1080, 1079,
+ 1087, 1086, 1096, 1097, 1102, 1101, 1112, 1111, 1122, 1121,
+ 1132, 1131, 1142, 1141, 1152, 1151, 1162, 1161, 1172, 1171,
+ 1185, 1198, 1196, 1226, 1233, 1244, 1243, 1271, 1269, 1296,
+ 1308, 1354, 1382, 1413, 1418, 1423, 1428, 1412, 1481, 1482,
+ 1483, 1484, 1485, 1486, 1487, 1499, 1504, 1579, 1581, 1583,
+ 1584, 1598, 1599, 1613, 1614, 1627, 1628, 1638, 1651, 1652,
+ 1662, 1675, 1676, 1686, 1696, 1709, 1710, 1720, 1730, 1743,
+ 1778, 1779, 1788, 1793, 1800, 1808, 1813, 1818, 1824, 1829,
+ 1834, 1842, 1914, 1913, 1923, 1928, 1933, 1938, 1965, 1974,
+ 1973, 2032, 2033, 2037, 2045, 2046, 2074, 2075, 2076, 2077,
+ 2078, 2079, 2080, 2081, 2085, 2086, 2087, 2091, 2092, 2093,
+ 2097, 2098, 2102, 2115, 2113, 2143, 2150, 2151, 2155, 2168,
+ 2166, 2196, 2203, 2220, 2239, 2240, 2244, 2249, 2254, 2262,
+ 2267, 2272, 2280, 2285, 2290, 2298, 2312, 2317, 2325, 2333,
+ 2341, 2349, 2358, 2357, 2373, 2407, 2412, 2372, 2431, 2434,
+ 2435, 2439, 2439, 2449, 2454, 2448, 2517, 2516, 2531, 2530,
+ 2545, 2550, 2555, 2560, 2607, 2612, 2544, 2636, 2644, 2658,
+ 2668, 2676, 2677, 2785, 2788, 2789, 2794, 2799, 2793, 2835,
+ 2834, 2848, 2859, 2881, 2889, 2888, 2904, 2909, 2903, 2926,
+ 2925, 2978, 3002, 3027, 3032, 3065, 3070, 3026, 3096, 3101,
+ 3099, 3106, 3110, 3147, 3152, 3145, 3219, 3274, 3284, 3273,
+ 3299, 3304, 3297, 3345, 3369, 3379, 3384, 3377, 3414, 3437,
+ 3446, 3445, 3481, 3492, 3514, 3522, 3527, 3521, 3564, 3565,
+ 3570, 3575, 3580, 3585, 3569, 3654, 3659, 3664, 3669, 3653,
+ 3747, 3752, 3782, 3787, 3746, 3805, 3810, 3863, 3868, 3803,
+ 3905, 3911, 3918, 3925, 3926, 3938, 3944, 3986, 3937, 4008,
+ 4007, 4018, 4017, 4030, 4035, 4033, 4040, 4045, 4050, 4044,
+ 4091, 4090, 4101, 4100, 4113, 4118, 4116, 4123, 4128, 4133,
+ 4127, 4180, 4188, 4189, 4190, 4233, 4238, 4243, 4252, 4257,
+ 4251, 4269, 4277, 4282, 4276, 4294, 4302, 4307, 4301, 4319,
+ 4327, 4332, 4326, 4344, 4351, 4364, 4362, 4390, 4397, 4426,
+ 4464, 4465, 4469, 4499, 4539, 4544, 4498, 4563, 4568, 4561,
+ 4610, 4609, 4620, 4627, 4628, 4633, 4632, 4643, 4642, 4653,
+ 4652, 4663, 4662, 4673, 4672, 4683, 4682, 4695, 4759, 4766,
+ 4791, 4864, 4870, 4877, 4935, 4993, 5052, 5051, 5101, 5106,
+ 5111, 5116, 5121, 5126, 5100, 5180, 5179, 5190, 5197, 5204,
+ 5212, 5217, 5211, 5229, 5230, 5234, 5236, 5235, 5246, 5245,
+ 5260, 5296, 5258, 5330, 5366, 5328, 5398, 5399, 5400, 5404,
+ 5405, 5409, 5437, 5468, 5513, 5518, 5466, 5535, 5545, 5564,
+ 5576, 5575, 5626, 5676, 5681, 5624, 5698, 5703
};
#endif
@@ -822,7 +815,7 @@ static const char *const tao_yytname[] =
# ifdef TAO_YYPRINT
/* TAO_YYTOKNUM[TAO_YYLEX-NUM] -- Internal token number corresponding to
token TAO_YYLEX-NUM. */
-static const unsigned short int tao_yytoknum[] =
+static const unsigned short tao_yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
@@ -838,7 +831,7 @@ static const unsigned short int tao_yytoknum[] =
# endif
/* TAO_YYR1[TAO_YYN] -- Symbol number of symbol that rule TAO_YYN derives. */
-static const unsigned short int tao_yyr1[] =
+static const unsigned short tao_yyr1[] =
{
0, 100, 101, 102, 102, 104, 103, 105, 103, 106,
103, 107, 103, 108, 103, 109, 103, 110, 103, 111,
@@ -946,7 +939,7 @@ static const unsigned char tao_yyr2[] =
/* TAO_YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
STATE-NUM when TAO_YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
-static const unsigned short int tao_yydefact[] =
+static const unsigned short tao_yydefact[] =
{
4, 0, 0, 1, 27, 113, 29, 40, 162, 222,
238, 273, 320, 0, 0, 0, 0, 64, 0, 0,
@@ -1019,7 +1012,7 @@ static const unsigned short int tao_yydefact[] =
};
/* TAO_YYDEFGOTO[NTERM-NUM]. */
-static const short int tao_yydefgoto[] =
+static const short tao_yydefgoto[] =
{
-1, 1, 2, 23, 146, 150, 151, 145, 149, 96,
95, 100, 152, 154, 156, 67, 24, 69, 225, 310,
@@ -1059,7 +1052,7 @@ static const short int tao_yydefgoto[] =
/* TAO_YYPACT[STATE-NUM] -- Index in TAO_YYTABLE of the portion describing
STATE-NUM. */
#define TAO_YYPACT_NINF -483
-static const short int tao_yypact[] =
+static const short tao_yypact[] =
{
-483, 49, 1047, -483, -483, -483, -483, -483, -483, -483,
-483, -483, -483, 61, 60, 66, 68, -483, 61, 61,
@@ -1132,7 +1125,7 @@ static const short int tao_yypact[] =
};
/* TAO_YYPGOTO[NTERM-NUM]. */
-static const short int tao_yypgoto[] =
+static const short tao_yypgoto[] =
{
-483, -483, 189, -483, -483, -483, -483, -483, -483, -483,
-483, -483, -483, -483, -483, -483, -483, -483, -483, -483,
@@ -1174,7 +1167,7 @@ static const short int tao_yypgoto[] =
number is the opposite. If zero, do what TAO_YYDEFACT says.
If TAO_YYTABLE_NINF, syntax error. */
#define TAO_YYTABLE_NINF -475
-static const short int tao_yytable[] =
+static const short tao_yytable[] =
{
77, 78, 138, 92, 94, 88, 89, 169, 170, 134,
119, 135, 350, 38, 136, 163, 118, 166, 137, 167,
@@ -1290,7 +1283,7 @@ static const short int tao_yytable[] =
21, 22
};
-static const short int tao_yycheck[] =
+static const short tao_yycheck[] =
{
13, 13, 34, 21, 22, 18, 19, 68, 68, 34,
34, 34, 286, 2, 34, 68, 34, 68, 34, 68,
@@ -1408,7 +1401,7 @@ static const short int tao_yycheck[] =
/* TAO_YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
-static const unsigned short int tao_yystos[] =
+static const unsigned short tao_yystos[] =
{
0, 101, 102, 0, 1, 4, 5, 6, 7, 20,
21, 23, 27, 40, 41, 42, 43, 49, 50, 53,
@@ -1591,12 +1584,12 @@ do { \
#if defined (__STDC__) || defined (__cplusplus)
static void
-tao_yy_stack_print (short int *bottom, short int *top)
+tao_yy_stack_print (short *bottom, short *top)
#else
static void
tao_yy_stack_print (bottom, top)
- short int *bottom;
- short int *top;
+ short *bottom;
+ short *top;
#endif
{
TAO_YYFPRINTF (stderr, "Stack now");
@@ -1853,9 +1846,9 @@ tao_yyparse ()
to reallocate them elsewhere. */
/* The state stack. */
- short int tao_yyssa[TAO_YYINITDEPTH];
- short int *tao_yyss = tao_yyssa;
- register short int *tao_yyssp;
+ short tao_yyssa[TAO_YYINITDEPTH];
+ short *tao_yyss = tao_yyssa;
+ register short *tao_yyssp;
/* The semantic value stack. */
TAO_YYSTYPE tao_yyvsa[TAO_YYINITDEPTH];
@@ -1892,7 +1885,6 @@ tao_yyparse ()
tao_yyssp = tao_yyss;
tao_yyvsp = tao_yyvs;
-
goto tao_yysetstate;
/*------------------------------------------------------------.
@@ -1918,7 +1910,7 @@ tao_yyparse ()
these so that the &'s don't force the real ones into
memory. */
TAO_YYSTYPE *tao_yyvs1 = tao_yyvs;
- short int *tao_yyss1 = tao_yyss;
+ short *tao_yyss1 = tao_yyss;
/* Each stack pointer address is followed by the size of the
@@ -1946,7 +1938,7 @@ tao_yyparse ()
tao_yystacksize = TAO_YYMAXDEPTH;
{
- short int *tao_yyss1 = tao_yyss;
+ short *tao_yyss1 = tao_yyss;
union tao_yyalloc *tao_yyptr =
(union tao_yyalloc *) TAO_YYSTACK_ALLOC (TAO_YYSTACK_BYTES (tao_yystacksize));
if (! tao_yyptr)
@@ -2284,6 +2276,8 @@ tao_yyreduce:
{
// IDENTIFIER
Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
UTL_ScopedName n (&id,
0);
AST_Module *m = 0;
@@ -2452,6 +2446,13 @@ tao_yyreduce:
false,
true),
1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
}
break;
@@ -2478,6 +2479,13 @@ tao_yyreduce:
false,
true),
1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
}
break;
@@ -2504,6 +2512,13 @@ tao_yyreduce:
true,
true),
1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
}
break;
@@ -2727,6 +2742,20 @@ tao_yyreduce:
tao_yyvsp[0].nlval,
tao_yyvsp[-2].nlval ? tao_yyvsp[-2].nlval->truncatable () : false),
1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ if (0 != tao_yyvsp[-2].nlval)
+ {
+ tao_yyvsp[-2].nlval->destroy ();
+ delete tao_yyvsp[-2].nlval;
+ tao_yyvsp[-2].nlval = 0;
+ }
}
break;
@@ -2799,6 +2828,10 @@ tao_yyreduce:
true);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -2822,6 +2855,10 @@ tao_yyreduce:
false);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -2829,52 +2866,54 @@ tao_yyreduce:
{
// value_box_decl : value_decl type_spec
- idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
-
- UTL_Scope *s = idl_global->scopes ().top_non_null ();
- UTL_ScopedName n (tao_yyvsp[-1].idval,
- 0);
+ idl_global->set_parse_state (IDL_GlobalData::PS_ValueBoxDeclSeen);
- if (s != 0 && tao_yyvsp[0].dcval != 0)
- {
- /*
- * Get the type_spec associated with the valuebox
- */
- AST_Type *tp = 0;
- AST_Typedef *td
- = AST_Typedef::narrow_from_decl (tao_yyvsp[0].dcval);
+ UTL_Scope *s = idl_global->scopes ().top_non_null ();
+ UTL_ScopedName n (tao_yyvsp[-1].idval,
+ 0);
- if (td == 0)
- {
- tp = AST_Type::narrow_from_decl (tao_yyvsp[0].dcval);
- }
- else
- {
- tp = td->primitive_base_type ();
- }
+ if (s != 0 && tao_yyvsp[0].dcval != 0)
+ {
+ /*
+ * Get the type_spec associated with the valuebox
+ */
+ AST_Type *tp = 0;
+ AST_Typedef *td
+ = AST_Typedef::narrow_from_decl (tao_yyvsp[0].dcval);
- if (tp == 0)
- { // The <type_spec> given is a valid type
- idl_global->err ()->not_a_type (tao_yyvsp[0].dcval);
- }
+ if (td == 0)
+ {
+ tp = AST_Type::narrow_from_decl (tao_yyvsp[0].dcval);
+ }
+ else
+ {
+ tp = td->primitive_base_type ();
+ }
- else if (tp->node_type() == AST_Decl::NT_valuetype)
- { // valuetype is not allowed as <type_spec> for boxed value
- idl_global->err ()->error0 (
- UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
- );
- }
+ if (tp == 0)
+ { // The <type_spec> given is a valid type
+ idl_global->err ()->not_a_type (tao_yyvsp[0].dcval);
+ }
+ else if (tp->node_type() == AST_Decl::NT_valuetype)
+ { // valuetype is not allowed as <type_spec> for boxed value
+ idl_global->err ()->error0 (
+ UTL_Error::EIDL_ILLEGAL_BOXED_TYPE
+ );
+ }
+ else
+ {
+ /*
+ * Add the valuebox to its definition scope
+ */
+ AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
+ tp);
+ (void) s->fe_add_valuebox (vb);
+ }
+ }
- else
- {
- /*
- * Add the valuebox to its definition scope
- */
- AST_ValueBox *vb = idl_global->gen ()->create_valuebox (&n,
- tp);
- (void) s->fe_add_valuebox (vb);
- }
- }
+ tao_yyvsp[-1].idval->destroy ();
+ delete tao_yyvsp[-1].idval;
+ tao_yyvsp[-1].idval = 0;
}
break;
@@ -3109,6 +3148,8 @@ tao_yyreduce:
ACE_NEW_RETURN (id,
Identifier (tao_yyvsp[-2].strval),
1);
+ ACE::strdelete (tao_yyvsp[-2].strval);
+ tao_yyvsp[-2].strval = 0;
UTL_IdList *sn = 0;
ACE_NEW_RETURN (sn,
UTL_IdList (tao_yyvsp[0].idval,
@@ -3126,6 +3167,12 @@ tao_yyreduce:
{
// | scoped_name IDL_SCOPE_DELIMITOR
idl_global->set_parse_state (IDL_GlobalData::PS_ScopeDelimSeen);
+
+ // This cleans up all the non-global "::"s in scoped names.
+ // If there is a global one, it gets put into the UTL_IdList,
+ // so we clean it up in the case above.
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
}
break;
@@ -3152,7 +3199,8 @@ tao_yyreduce:
ACE_NEW_RETURN (tao_yyval.idval,
Identifier (tao_yyvsp[0].strval),
1);
- ACE_OS::free (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
}
break;
@@ -3175,6 +3223,11 @@ tao_yyreduce:
);
(void) s->add_predefined_type (pdt);
s->add_to_scope (pdt);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
break;
}
@@ -3192,6 +3245,10 @@ tao_yyreduce:
0);
(void) s->fe_add_interface_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -3218,6 +3275,10 @@ tao_yyreduce:
0);
(void) s->fe_add_interface_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -3244,6 +3305,10 @@ tao_yyreduce:
1);
(void) s->fe_add_interface_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -3304,6 +3369,9 @@ tao_yyreduce:
{
idl_global->err ()->coercion_error (tao_yyvsp[0].exval,
tao_yyvsp[-6].etval);
+ tao_yyvsp[0].exval->destroy ();
+ delete tao_yyvsp[0].exval;
+ tao_yyvsp[0].exval = 0;
}
else
{
@@ -3315,6 +3383,7 @@ tao_yyreduce:
);
(void) s->fe_add_constant (c);
delete result;
+ result = 0;
}
tao_yyvsp[-4].idval->destroy ();
@@ -3363,6 +3432,10 @@ tao_yyreduce:
s->lookup_by_name (tao_yyvsp[0].idlist,
true);
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+
if (s != 0 && d != 0)
{
tao_enum_constant_decl = d;
@@ -3601,7 +3674,7 @@ tao_yyreduce:
*/
UTL_Scope *s = idl_global->scopes ().top_non_null ();
AST_Decl *d = s->lookup_by_name (tao_yyvsp[0].idlist,
- true);
+ true);
/*
* If the scoped name is an IDL constant, it may be used in an
@@ -3613,8 +3686,13 @@ tao_yyreduce:
if (d != 0 && d->node_type () == AST_Decl::NT_const)
{
AST_Constant *c = AST_Constant::narrow_from_decl (d);
- tao_yyval.exval = idl_global->gen ()->create_expr (c->constant_value (),
- c->et ());
+ tao_yyval.exval =
+ idl_global->gen ()->create_expr (c->constant_value (),
+ c->et ());
+
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
}
else
{
@@ -3655,6 +3733,9 @@ tao_yyreduce:
{
// | IDL_STRING_LITERAL
tao_yyval.exval = idl_global->gen ()->create_expr (tao_yyvsp[0].sval);
+ tao_yyvsp[0].sval->destroy ();
+ delete tao_yyvsp[0].sval;
+ tao_yyvsp[0].sval = 0;
}
break;
@@ -3769,9 +3850,7 @@ tao_yyreduce:
if (good_expression)
{
- tao_yyval.exval =
- idl_global->gen()->create_expr (tao_yyvsp[0].exval,
- AST_Expression::EV_ulong);
+ tao_yyval.exval = tao_yyvsp[0].exval;
}
else
{
@@ -3843,6 +3922,10 @@ tao_yyreduce:
*/
(void) s->fe_add_native (node);
}
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
}
break;
@@ -3895,6 +3978,12 @@ tao_yyreduce:
continue;
}
+ if (AST_Decl::NT_except == tp->node_type ())
+ {
+ idl_global->err ()->not_a_type (tp);
+ continue;
+ }
+
t = idl_global->gen ()->create_typedef (tp,
d->name (),
s->is_local (),
@@ -4272,6 +4361,10 @@ tao_yyreduce:
* Push the scope of the struct on the scopes stack.
*/
idl_global->scopes ().push (d);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -4386,6 +4479,10 @@ tao_yyreduce:
(void) s->fe_add_field (f);
}
}
+
+ tao_yyvsp[-2].dlval->destroy ();
+ delete tao_yyvsp[-2].dlval;
+ tao_yyvsp[-2].dlval = 0;
}
break;
@@ -4490,6 +4587,10 @@ tao_yyreduce:
* Push the scope of the union on the scopes stack
*/
idl_global->scopes ().push (u);
+
+ tao_yyvsp[-7].idval->destroy ();
+ delete tao_yyvsp[-7].idval;
+ tao_yyvsp[-7].idval = 0;
}
break;
@@ -4676,9 +4777,17 @@ tao_yyreduce:
{
idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+
/* If we don't return here, we'll crash later.*/
return 1;
}
+
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
}
break;
@@ -4722,6 +4831,12 @@ tao_yyreduce:
f->name ()
);
(void) s->fe_add_union_branch (b);
+
+ // f has passed its field type to the union branch,
+ // but the rest still needs to be cleaned up.
+ f->AST_Decl::destroy ();
+ delete f;
+ f = 0;
}
}
break;
@@ -4883,6 +4998,10 @@ tao_yyreduce:
tao_yyvsp[0].deval->name ()
);
}
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
}
}
break;
@@ -4904,6 +5023,10 @@ tao_yyreduce:
d = idl_global->gen ()->create_structure_fwd (&n);
(void) s->fe_add_structure_fwd (d);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -4924,6 +5047,10 @@ tao_yyreduce:
u = idl_global->gen ()->create_union_fwd (&n);
(void) s->fe_add_union_fwd (u);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -4941,7 +5068,7 @@ tao_yyreduce:
// id
UTL_Scope *s = idl_global->scopes ().top_non_null ();
UTL_ScopedName n (tao_yyvsp[0].idval,
- 0);
+ 0);
AST_Enum *e = 0;
idl_global->set_parse_state (IDL_GlobalData::PS_EnumIDSeen);
@@ -4964,6 +5091,10 @@ tao_yyreduce:
* Push the enum scope on the scopes stack.
*/
idl_global->scopes ().push (e);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -5020,6 +5151,8 @@ tao_yyreduce:
// enumerator : IDENTIFIER
UTL_Scope *s = idl_global->scopes ().top_non_null ();
Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
UTL_ScopedName n (&id,
0);
AST_EnumVal *e = 0;
@@ -5082,13 +5215,20 @@ tao_yyreduce:
/*
* Create a node representing a sequence
*/
- if (tao_yyvsp[-2].exval == 0 || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0)
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if (tao_yyvsp[-2].exval != 0)
+ {
+ ev = tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == tao_yyvsp[-2].exval || 0 == ev)
{
idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
AST_Expression::EV_ulong);
tao_yyval.dcval = 0;
}
- else if (tao_yyvsp[-5].dcval == 0)
+ else if (0 == tao_yyvsp[-5].dcval)
{
tao_yyval.dcval = 0;
}
@@ -5096,7 +5236,7 @@ tao_yyreduce:
{
AST_Type *tp = AST_Type::narrow_from_decl (tao_yyvsp[-5].dcval);
- if (tp == 0)
+ if (0 == tp)
{
; // Error will be caught in FE_Declarator.
}
@@ -5116,6 +5256,9 @@ tao_yyreduce:
);
}
}
+
+ delete ev;
+ ev = 0;
}
break;
@@ -5227,8 +5370,14 @@ tao_yyreduce:
/*
* Create a node representing a string.
*/
- if (tao_yyvsp[-2].exval == 0
- || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0)
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if (tao_yyvsp[-2].exval != 0)
+ {
+ ev = tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == tao_yyvsp[-2].exval || 0 == ev)
{
idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
AST_Expression::EV_ulong);
@@ -5246,6 +5395,9 @@ tao_yyreduce:
)
);
}
+
+ delete ev;
+ ev = 0;
}
break;
@@ -5386,6 +5538,12 @@ tao_yyreduce:
0,
0
);
+
+ tao_yyvsp[0].elval->destroy ();
+ delete tao_yyvsp[0].elval;
+ tao_yyvsp[0].elval = 0;
+
+ sn.destroy ();
}
}
break;
@@ -5459,8 +5617,14 @@ tao_yyreduce:
* Array dimensions are expressions which must be coerced to
* positive integers.
*/
- if (tao_yyvsp[-2].exval == 0
- || tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong) == 0)
+ AST_Expression::AST_ExprValue *ev = 0;
+
+ if (tao_yyvsp[-2].exval != 0)
+ {
+ ev = tao_yyvsp[-2].exval->coerce (AST_Expression::EV_ulong);
+ }
+
+ if (0 == tao_yyvsp[-2].exval || 0 == ev)
{
idl_global->err ()->coercion_error (tao_yyvsp[-2].exval,
AST_Expression::EV_ulong);
@@ -5470,6 +5634,9 @@ tao_yyreduce:
{
tao_yyval.exval = tao_yyvsp[-2].exval;
}
+
+ delete ev;
+ ev = 0;
}
break;
@@ -5545,7 +5712,7 @@ tao_yyreduce:
idl_global->gen ()->create_attribute (
true,
tp,
- (UTL_IdList *) d->name ()->copy (),
+ d->name (),
s->is_local (),
s->is_abstract ()
);
@@ -5553,11 +5720,19 @@ tao_yyreduce:
if (tao_yyvsp[0].nlval != 0)
{
(void) a->fe_add_get_exceptions (tao_yyvsp[0].nlval);
+
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
}
(void) s->fe_add_attribute (a);
}
}
+
+ tao_yyvsp[-2].dlval->destroy ();
+ delete tao_yyvsp[-2].dlval;
+ tao_yyvsp[-2].dlval = 0;
}
break;
@@ -5633,7 +5808,7 @@ tao_yyreduce:
idl_global->gen ()->create_attribute (
false,
tp,
- (UTL_IdList *) d->name ()->copy (),
+ d->name (),
s->is_local (),
s->is_abstract ()
);
@@ -5641,16 +5816,28 @@ tao_yyreduce:
if (tao_yyvsp[-2].nlval != 0)
{
(void) a->fe_add_get_exceptions (tao_yyvsp[-2].nlval);
+
+ tao_yyvsp[-2].nlval->destroy ();
+ delete tao_yyvsp[-2].nlval;
+ tao_yyvsp[-2].nlval = 0;
}
if (tao_yyvsp[0].nlval != 0)
{
(void) a->fe_add_set_exceptions (tao_yyvsp[0].nlval);
+
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
}
(void) s->fe_add_attribute (a);
}
}
+
+ tao_yyvsp[-4].dlval->destroy ();
+ delete tao_yyvsp[-4].dlval;
+ tao_yyvsp[-4].dlval = 0;
}
break;
@@ -5688,6 +5875,10 @@ tao_yyreduce:
* Push the exception scope on the scope stack.
*/
idl_global->scopes ().push (e);
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -5733,6 +5924,9 @@ tao_yyreduce:
// IDENTIFIER
UTL_Scope *s = idl_global->scopes ().top_non_null ();
Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+
UTL_ScopedName n (&id,
0);
AST_Operation *o = 0;
@@ -5773,9 +5967,6 @@ tao_yyreduce:
}
}
- ACE_OS::free (tao_yyvsp[0].strval);
- tao_yyvsp[0].strval = 0;
-
/*
* Push the operation scope onto the scopes stack.
*/
@@ -5893,9 +6084,14 @@ tao_yyreduce:
ACE_TEXT ("factory construct.\n"),
idl_global->filename ()->get_string (),
idl_global->lineno ()));
+
+ idl_global->set_err_count (idl_global->err_count () + 1);
}
Identifier id (tao_yyvsp[0].strval);
+ ACE::strdelete (tao_yyvsp[0].strval);
+ tao_yyvsp[0].strval = 0;
+
UTL_ScopedName n (&id,
0);
AST_Factory *factory = 0;
@@ -6022,12 +6218,16 @@ tao_yyreduce:
a = idl_global->gen ()->create_argument (
AST_Argument::dir_IN,
tp,
- (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy ()
+ tao_yyvsp[0].deval->name ()
);
(void) s->fe_add_argument (a);
}
}
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
}
break;
@@ -6117,12 +6317,16 @@ tao_yyreduce:
idl_global->gen ()->create_argument (
tao_yyvsp[-4].dival,
tp,
- (UTL_IdList *) tao_yyvsp[0].deval->name ()->copy ()
+ tao_yyvsp[0].deval->name ()
);
(void) s->fe_add_argument (a);
}
}
}
+
+ tao_yyvsp[0].deval->destroy ();
+ delete tao_yyvsp[0].deval;
+ tao_yyvsp[0].deval = 0;
}
break;
@@ -6341,9 +6545,9 @@ tao_yyreduce:
{
// at_least_one_string_literal : IDL_STRING_LITERAL string_literals
ACE_NEW_RETURN (tao_yyval.slval,
- UTL_StrList (tao_yyvsp[-1].sval,
- tao_yyvsp[0].slval),
- 1);
+ UTL_StrList (tao_yyvsp[-1].sval,
+ tao_yyvsp[0].slval),
+ 1);
}
break;
@@ -6405,6 +6609,14 @@ tao_yyreduce:
tao_yyvsp[0].sval->get_string ()
);
}
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].sval->destroy ();
+ delete tao_yyvsp[0].sval;
+ tao_yyvsp[0].sval = 0;
}
break;
@@ -6435,6 +6647,14 @@ tao_yyreduce:
tao_yyvsp[0].sval->get_string ()
);
}
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].sval->destroy ();
+ delete tao_yyvsp[0].sval;
+ tao_yyvsp[0].sval = 0;
}
break;
@@ -6459,6 +6679,10 @@ tao_yyreduce:
f = idl_global->gen ()->create_component_fwd (&n);
(void) s->fe_add_component_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -6570,6 +6794,20 @@ tao_yyreduce:
tao_yyvsp[0].nlval,
false),
1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ if (0 != tao_yyvsp[-2].idlist)
+ {
+ tao_yyvsp[-2].idlist->destroy ();
+ delete tao_yyvsp[-2].idlist;
+ tao_yyvsp[-2].idlist = 0;
+ }
}
break;
@@ -6704,9 +6942,18 @@ tao_yyreduce:
{
AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
break;
}
else if (d->node_type () != AST_Decl::NT_interface)
@@ -6718,9 +6965,19 @@ tao_yyreduce:
!= 0)
{
idl_global->err ()->interface_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
break;
}
}
+
AST_Type *interface_type =
AST_Type::narrow_from_decl (d);
@@ -6729,6 +6986,10 @@ tao_yyreduce:
pd.impl = interface_type;
c->provides ().enqueue_tail (pd);
}
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
}
break;
@@ -6736,19 +6997,8 @@ tao_yyreduce:
{
// interface_type : scoped_name
- UTL_Scope *s = idl_global->scopes ().top_non_null ();
- AST_Decl *d = s->lookup_by_name (tao_yyvsp[0].idlist,
- true);
-
- if (d == 0)
- {
- idl_global->err ()->lookup_error (tao_yyvsp[0].idlist);
- }
- else if (d->node_type () != AST_Decl::NT_interface)
- {
- idl_global->err ()->interface_expected (d);
- }
-
+ // Lookups and checking are done where the 'interface_type'
+ // token is used, in 'provides_decl' and 'uses_decl'.
tao_yyval.idlist = tao_yyvsp[0].idlist;
}
break;
@@ -6786,9 +7036,18 @@ tao_yyreduce:
AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
break;
}
else if (d->node_type () != AST_Decl::NT_interface)
@@ -6798,6 +7057,15 @@ tao_yyreduce:
!= 0)
{
idl_global->err ()->interface_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
break;
}
}
@@ -6823,6 +7091,10 @@ tao_yyreduce:
idl_global->create_uses_multiple_stuff (c, ud);
}
}
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
}
break;
@@ -6850,13 +7122,33 @@ tao_yyreduce:
AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
}
else if (d->node_type () != AST_Decl::NT_eventtype)
{
idl_global->err ()->eventtype_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
}
else
{
@@ -6871,6 +7163,10 @@ tao_yyreduce:
c->emits ().enqueue_tail (pd);
}
}
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
}
break;
@@ -6882,13 +7178,33 @@ tao_yyreduce:
AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
}
else if (d->node_type () != AST_Decl::NT_eventtype)
{
idl_global->err ()->eventtype_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
}
else
{
@@ -6903,6 +7219,10 @@ tao_yyreduce:
c->publishes ().enqueue_tail (pd);
}
}
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
}
break;
@@ -6914,13 +7234,33 @@ tao_yyreduce:
AST_Decl *d = s->lookup_by_name (tao_yyvsp[-1].idlist,
true);
- if (d == 0)
+ if (0 == d)
{
idl_global->err ()->lookup_error (tao_yyvsp[-1].idlist);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
}
else if (d->node_type () != AST_Decl::NT_eventtype)
{
idl_global->err ()->eventtype_expected (d);
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
+
+ break;
}
else
{
@@ -6935,6 +7275,10 @@ tao_yyreduce:
c->consumes ().enqueue_tail (pd);
}
}
+
+ tao_yyvsp[-1].idlist->destroy ();
+ delete tao_yyvsp[-1].idlist;
+ tao_yyvsp[-1].idlist = 0;
}
break;
@@ -7059,6 +7403,31 @@ tao_yyreduce:
tao_yyvsp[-2].idlist,
tao_yyvsp[0].idlist),
1);
+
+ tao_yyvsp[-2].idlist->destroy ();
+ delete tao_yyvsp[-2].idlist;
+ tao_yyvsp[-2].idlist = 0;
+
+ if (0 != tao_yyvsp[-8].idlist)
+ {
+ tao_yyvsp[-8].idlist->destroy ();
+ delete tao_yyvsp[-8].idlist;
+ tao_yyvsp[-8].idlist = 0;
+ }
+
+ if (0 != tao_yyvsp[0].idlist)
+ {
+ tao_yyvsp[0].idlist->destroy ();
+ delete tao_yyvsp[0].idlist;
+ tao_yyvsp[0].idlist = 0;
+ }
+
+ if (0 != tao_yyvsp[-6].nlval)
+ {
+ tao_yyvsp[-6].nlval->destroy ();
+ delete tao_yyvsp[-6].nlval;
+ tao_yyvsp[-6].nlval = 0;
+ }
}
break;
@@ -7186,8 +7555,9 @@ tao_yyreduce:
home->factories ().enqueue_tail (o);
}
- delete tao_yyvsp[0].idval;
- tao_yyvsp[0].idval = 0;
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
/*
* Push the operation scope onto the scopes stack.
@@ -7260,8 +7630,9 @@ tao_yyreduce:
home->finders ().enqueue_tail (o);
}
- delete tao_yyvsp[0].idval;
- tao_yyvsp[0].idval = 0;
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
/*
* Push the operation scope onto the scopes stack.
@@ -7326,6 +7697,10 @@ tao_yyreduce:
false);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -7349,6 +7724,10 @@ tao_yyreduce:
true);
(void) s->fe_add_valuetype_fwd (f);
}
+
+ tao_yyvsp[0].idval->destroy ();
+ delete tao_yyvsp[0].idval;
+ tao_yyvsp[0].idval = 0;
}
break;
@@ -7393,6 +7772,10 @@ tao_yyreduce:
* Push it on the scope stack.
*/
idl_global->scopes ().push (e);
+
+ tao_yyvsp[-1].idval->destroy ();
+ delete tao_yyvsp[-1].idval;
+ tao_yyvsp[-1].idval = 0;
}
break;
@@ -7436,7 +7819,7 @@ tao_yyreduce:
case 468:
{
-// id
+// event_custom_header : IDL_CUSTOM IDL_EVENTTYPE id
idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
ACE_DEBUG ((LM_DEBUG,
@@ -7453,7 +7836,7 @@ tao_yyreduce:
case 469:
{
-// id
+// event_plain_header : IDL_EVENTTYPE id
idl_global->set_parse_state (IDL_GlobalData::PS_EventTypeIDSeen);
tao_yyval.idval = tao_yyvsp[0].idval;
@@ -7476,11 +7859,29 @@ tao_yyreduce:
idl_global->set_parse_state (IDL_GlobalData::PS_SupportSpecSeen);
ACE_NEW_RETURN (tao_yyval.ehval,
- FE_EventHeader (0,
- tao_yyvsp[-2].nlval,
- tao_yyvsp[0].nlval,
- tao_yyvsp[-2].nlval ? tao_yyvsp[-2].nlval->truncatable () : false),
+ FE_EventHeader (
+ 0,
+ tao_yyvsp[-2].nlval,
+ tao_yyvsp[0].nlval,
+ tao_yyvsp[-2].nlval
+ ? tao_yyvsp[-2].nlval->truncatable ()
+ : false
+ ),
1);
+
+ if (0 != tao_yyvsp[0].nlval)
+ {
+ tao_yyvsp[0].nlval->destroy ();
+ delete tao_yyvsp[0].nlval;
+ tao_yyvsp[0].nlval = 0;
+ }
+
+ if (0 != tao_yyvsp[-2].nlval)
+ {
+ tao_yyvsp[-2].nlval->destroy ();
+ delete tao_yyvsp[-2].nlval;
+ tao_yyvsp[-2].nlval = 0;
+ }
}
break;
@@ -7494,6 +7895,8 @@ tao_yyreduce:
if (s != 0 && tao_yyvsp[-1].idval != 0)
{
+ // We create the scoped name here instead of with the
+ // FE_EventHeader because there is a token for it only here.
UTL_ScopedName sn (tao_yyvsp[-1].idval,
0);
e =
@@ -7524,6 +7927,8 @@ tao_yyreduce:
tao_yyvsp[0].ehval->destroy ();
delete tao_yyvsp[0].ehval;
tao_yyvsp[0].ehval = 0;
+
+ sn.destroy ();
}
/*
@@ -7581,7 +7986,7 @@ tao_yyreduce:
}
-/* Line 1010 of yacc.c. */
+/* Line 993 of yacc.c. */
tao_yyvsp -= tao_yylen;
diff --git a/TAO/TAO_IDL/fe/y.tab.cpp.diff b/TAO/TAO_IDL/fe/y.tab.cpp.diff
index 6dceda2e081..06b126a08d5 100644
--- a/TAO/TAO_IDL/fe/y.tab.cpp.diff
+++ b/TAO/TAO_IDL/fe/y.tab.cpp.diff
@@ -27,7 +27,7 @@
- }
}
-@@ -7741,7 +7741,7 @@
+@@ -8147,7 +8147,7 @@
`---------------------------------------------------*/
tao_yyerrorlab:
diff --git a/TAO/TAO_IDL/fe/y.tab.h b/TAO/TAO_IDL/fe/y.tab.h
index ffd1faa3772..283775bd192 100644
--- a/TAO/TAO_IDL/fe/y.tab.h
+++ b/TAO/TAO_IDL/fe/y.tab.h
@@ -210,7 +210,7 @@ typedef union TAO_YYSTYPE {
AST_Argument::Direction dival; /* Argument direction */
AST_Operation::Flags ofval; /* Operation flags */
FE_Declarator *deval; /* Declarator value */
- bool bval; /* Boolean value */
+ bool bval; /* Boolean value */
long ival; /* Long value */
idl_uns_long uival; /* Unsigned long value */
double dval; /* Double value */
diff --git a/TAO/TAO_IDL/include/ast_argument.h b/TAO/TAO_IDL/include/ast_argument.h
index 26557ba9da2..ef6fb1e66ef 100644
--- a/TAO/TAO_IDL/include/ast_argument.h
+++ b/TAO/TAO_IDL/include/ast_argument.h
@@ -108,6 +108,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_array.h b/TAO/TAO_IDL/include/ast_array.h
index 19b1cfa3f13..25985ee3a07 100644
--- a/TAO/TAO_IDL/include/ast_array.h
+++ b/TAO/TAO_IDL/include/ast_array.h
@@ -109,6 +109,9 @@ public:
// a primary key. Overridden for valuetype, struct, sequence,
// union, array, typedef, and interface.
virtual bool legal_for_primary_key (void) const;
+
+ // Cleanup.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS1(AST_Array, AST_ConcreteType);
@@ -135,8 +138,12 @@ private:
AST_Type *pd_base_type;
// Base type of array.
+
+ bool owns_base_type_;
+ // If our base type is anonymous array or sequence, we're
+ // responsible for destroying it.
- // Operations.
+private:
// Compute how many dimensions.
AST_Expression **compute_dims (UTL_ExprList *dims,
diff --git a/TAO/TAO_IDL/include/ast_attribute.h b/TAO/TAO_IDL/include/ast_attribute.h
index 14610600371..41b0f320e5b 100644
--- a/TAO/TAO_IDL/include/ast_attribute.h
+++ b/TAO/TAO_IDL/include/ast_attribute.h
@@ -105,6 +105,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
// Methods to add exceptions directly, used when copying node.
UTL_ExceptList *be_add_get_exceptions (UTL_ExceptList *t);
diff --git a/TAO/TAO_IDL/include/ast_concrete_type.h b/TAO/TAO_IDL/include/ast_concrete_type.h
index 79f132748c3..399ace99792 100644
--- a/TAO/TAO_IDL/include/ast_concrete_type.h
+++ b/TAO/TAO_IDL/include/ast_concrete_type.h
@@ -85,6 +85,9 @@ public:
// Destructor.
virtual ~AST_ConcreteType (void);
+
+ // Cleanup.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS1(AST_ConcreteType, AST_Type);
diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h
index ae56c2b8201..1e91a917742 100644
--- a/TAO/TAO_IDL/include/ast_decl.h
+++ b/TAO/TAO_IDL/include/ast_decl.h
@@ -101,8 +101,11 @@ public:
virtual ~COMMON_Base (void) {}
- virtual bool is_local (void);
- virtual bool is_abstract (void);
+ bool is_local (void) const;
+ void is_local (bool val);
+
+ bool is_abstract (void) const;
+ void is_abstract (bool val);
// A no-op, overridden in the child classes.
virtual void destroy (void);
diff --git a/TAO/TAO_IDL/include/ast_exception.h b/TAO/TAO_IDL/include/ast_exception.h
index e6c5e52c77a..f84b7f9e29b 100644
--- a/TAO/TAO_IDL/include/ast_exception.h
+++ b/TAO/TAO_IDL/include/ast_exception.h
@@ -101,6 +101,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
friend int tao_yyparse (void);
diff --git a/TAO/TAO_IDL/include/ast_expression.h b/TAO/TAO_IDL/include/ast_expression.h
index f379f6cd1d6..80b4a65c267 100644
--- a/TAO/TAO_IDL/include/ast_expression.h
+++ b/TAO/TAO_IDL/include/ast_expression.h
@@ -242,7 +242,6 @@ public:
void set_file_name (UTL_String *f);
ExprComb ec (void);
- void set_ec (ExprComb new_ec);
AST_ExprValue *ev (void);
void set_ev (AST_ExprValue *new_ev);
@@ -269,8 +268,6 @@ public:
// Evaluation and value coercion.
- AST_ExprValue *eval (EvalKind ek);
-
AST_ExprValue *coerce (ExprType t);
// Top-level method, called only from yy_parse.
diff --git a/TAO/TAO_IDL/include/ast_field.h b/TAO/TAO_IDL/include/ast_field.h
index 27b871ce041..d9434e0fb4e 100644
--- a/TAO/TAO_IDL/include/ast_field.h
+++ b/TAO/TAO_IDL/include/ast_field.h
@@ -114,6 +114,11 @@ public:
// Are we or do we contain a wstring?
virtual int contains_wstring (void);
+
+ // Determine this bit of state after we have
+ // be added to our aggregate type and before
+ // we are destroyed.
+ void set_recursive_flag (void);
// Narrowing.
DEF_NARROW_METHODS1(AST_Field, AST_Decl);
@@ -124,6 +129,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
// Data.
@@ -132,6 +140,11 @@ private:
// Base type for field.
Visibility pd_visibility;
+ // Used with valuetype and eventtype fields.
+
+ bool anonymous_type_;
+ // If our field type is anonymous array or sequence, we're
+ // responsible for destroying it.
};
#endif // _AST_FIELD_AST_FIELD_HH
diff --git a/TAO/TAO_IDL/include/ast_generator.h b/TAO/TAO_IDL/include/ast_generator.h
index 6d71b7be83b..37e34755e1c 100644
--- a/TAO/TAO_IDL/include/ast_generator.h
+++ b/TAO/TAO_IDL/include/ast_generator.h
@@ -109,15 +109,15 @@ public:
long n_inherits,
AST_Interface **inherits_flat,
long n_inherits_flat,
- bool local,
- bool abstract
+ bool is_local,
+ bool is_abstract
);
// Create a node representing a forward declaration of an interface.
virtual AST_InterfaceFwd *create_interface_fwd (
UTL_ScopedName *n,
- bool local,
- bool abstract
+ bool is_local,
+ bool is_abstract
);
// Create a node representing a valuetype.
@@ -128,18 +128,18 @@ public:
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom
);
// Create a node representing a forward declaration of a valuetype.
virtual AST_ValueTypeFwd *create_valuetype_fwd (
UTL_ScopedName *n,
- bool abstract
+ bool is_abstract
);
// Create a node representing an eventtype.
@@ -150,25 +150,25 @@ public:
AST_ValueType *inherits_concrete,
AST_Interface **inherits_flat,
long n_inherits_flat,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface *supports_concrete,
- bool abstract,
- bool truncatable,
- bool custom
+ bool is_abstract,
+ bool is_truncatable,
+ bool is_custom
);
// Create a node representing a forward declaration of an eventtype.
virtual AST_EventTypeFwd *create_eventtype_fwd (
UTL_ScopedName *n,
- bool abstract
+ bool is_abstract
);
// Create a node representing a component.
virtual AST_Component *create_component (
UTL_ScopedName *n,
AST_Component *base_component,
- AST_Interface **supports,
+ AST_Interface **supports_list,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat
@@ -185,7 +185,7 @@ public:
AST_Home *base_home,
AST_Component *managed_component,
AST_ValueType *primary_key,
- AST_Interface **supports,
+ AST_Interface **support_lists,
long n_supports,
AST_Interface **supports_flat,
long n_supports_flat
@@ -194,15 +194,15 @@ public:
// Create a node representing an exception.
virtual AST_Exception *create_exception (
UTL_ScopedName *n,
- bool local,
- bool abstract
+ bool is_local,
+ bool is_abstract
);
// Create a node representing a structure.
virtual AST_Structure *create_structure (
UTL_ScopedName *n,
- bool local,
- bool abstract
+ bool is_local,
+ bool is_abstract
);
// Create a node representing a forward declaration of a structure.
@@ -210,16 +210,16 @@ public:
// Create a node representing an enum.
virtual AST_Enum *create_enum (UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
// Create a node representing an operation on an interface.
virtual AST_Operation *create_operation (
AST_Type *rt,
AST_Operation::Flags fl,
UTL_ScopedName *n,
- bool local,
- bool abstract
+ bool is_local,
+ bool is_abstract
);
// Create a node representing a field in a structure, exception or
@@ -241,15 +241,15 @@ public:
bool ro,
AST_Type *ft,
UTL_ScopedName *n,
- bool local,
- bool abstract
+ bool is_local,
+ bool is_abstract
);
// Create a node representing a union.
virtual AST_Union *create_union (AST_ConcreteType *dt,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
// Create a node representing a forward declaration of a union.
virtual AST_UnionFwd *create_union_fwd (UTL_ScopedName *n);
@@ -307,15 +307,15 @@ public:
virtual AST_Array *create_array (UTL_ScopedName *n,
unsigned long ndims,
UTL_ExprList *dims,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
// Create a node representing a sequence type.
virtual AST_Sequence *create_sequence (AST_Expression *v,
AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
// Create a node representing a string type.
virtual AST_String *create_string (AST_Expression *v);
@@ -326,8 +326,8 @@ public:
// Create a node representing a type renaming (typedef).
virtual AST_Typedef*create_typedef (AST_Type *bt,
UTL_ScopedName *n,
- bool local,
- bool abstract);
+ bool is_local,
+ bool is_abstract);
// Create a node representing a native.
virtual AST_Native *create_native (UTL_ScopedName *n);
diff --git a/TAO/TAO_IDL/include/ast_interface.h b/TAO/TAO_IDL/include/ast_interface.h
index a173d6d05d6..b76bf719ca3 100644
--- a/TAO/TAO_IDL/include/ast_interface.h
+++ b/TAO/TAO_IDL/include/ast_interface.h
@@ -117,10 +117,7 @@ public:
// Is this interface defined? This predicate returns FALSE when an
// interface was forward declared but not defined yet, and TRUE in
// all other cases.
- bool is_defined (void)
- {
- return (pd_n_inherits < 0) ? false : true;
- }
+ bool is_defined (void);
// Check if we have redefined any of our parents' operations or attributes,
// and check if there is such a clash among the parents
@@ -129,6 +126,10 @@ public:
// Accessors for the member.
bool home_equiv (void) const;
void home_equiv (bool val);
+
+ // Accessors for the member.
+ AST_InterfaceFwd *fwd_decl (void) const;
+ void fwd_decl (AST_InterfaceFwd *node);
// Look through inherited interfaces.
virtual AST_Decl *look_in_inherited (UTL_ScopedName *e,
@@ -181,6 +182,9 @@ protected:
// Are we the equivalent interface of a home?
bool home_equiv_;
+
+ // The forward declaration we may have been created from.
+ AST_InterfaceFwd *fwd_decl_;
protected:
// Scope Management Protocol.
diff --git a/TAO/TAO_IDL/include/ast_interface_fwd.h b/TAO/TAO_IDL/include/ast_interface_fwd.h
index 10490254d1d..a23b5bcb319 100644
--- a/TAO/TAO_IDL/include/ast_interface_fwd.h
+++ b/TAO/TAO_IDL/include/ast_interface_fwd.h
@@ -87,10 +87,13 @@ public:
void set_full_definition (AST_Interface *nfd);
virtual bool is_defined (void);
+ void set_as_defined (void);
virtual bool is_local (void);
virtual bool is_valuetype (void);
virtual bool is_abstract_valuetype (void);
+
+ bool full_def_seen (void);
// Cleanup function.
virtual void destroy (void);
@@ -108,6 +111,9 @@ public:
private:
AST_Interface *pd_full_definition;
// The interface this is a forward declaration of.
+
+ bool is_defined_;
+ // Checking the member above isn't good enough.
};
#endif // _AST_INTERFACE_FWD_AST_INTERFACE_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_native.h b/TAO/TAO_IDL/include/ast_native.h
index 57f5548ed7c..5813d34d02a 100644
--- a/TAO/TAO_IDL/include/ast_native.h
+++ b/TAO/TAO_IDL/include/ast_native.h
@@ -27,6 +27,9 @@ public:
virtual ~AST_Native (void);
// Destructor.
+
+ virtual void destroy (void);
+ // Cleanup.
// Narrowing.
DEF_NARROW_METHODS1(AST_Native, AST_Exception);
diff --git a/TAO/TAO_IDL/include/ast_sequence.h b/TAO/TAO_IDL/include/ast_sequence.h
index 2bdcfb4c264..3f42238b91e 100644
--- a/TAO/TAO_IDL/include/ast_sequence.h
+++ b/TAO/TAO_IDL/include/ast_sequence.h
@@ -103,6 +103,9 @@ public:
// a primary key. Overridden for valuetype, struct, sequence,
// union, array, typedef, and interface.
virtual bool legal_for_primary_key (void) const;
+
+ // Cleanup method.
+ virtual void destroy (void);
// Narrowing.
DEF_NARROW_METHODS1(AST_Sequence, AST_ConcreteType);
@@ -124,6 +127,10 @@ private:
bool unbounded_;
// Whether we are bounded or unbounded.
+
+ bool owns_base_type_;
+ // If our base type is anonymous array or sequence, we're
+ // responsible for destroying it.
};
#endif // _AST_SEQUENCE_AST_SEQUENCE_HH
diff --git a/TAO/TAO_IDL/include/ast_structure.h b/TAO/TAO_IDL/include/ast_structure.h
index 98d228d833c..0bf38a9d74d 100644
--- a/TAO/TAO_IDL/include/ast_structure.h
+++ b/TAO/TAO_IDL/include/ast_structure.h
@@ -132,15 +132,16 @@ public:
// Is this struct or union defined? This predicate returns FALSE when a
// forward declaration is not defined yet, and TRUE in
// all other cases.
- bool is_defined (void)
- {
- return this->size_type () != AST_Type::SIZE_UNKNOWN;
- }
+ virtual bool is_defined (void);
// Recursively called on valuetype to check for legal use as
// a primary key. Overridden for valuetype, struct, sequence,
// union, array, typedef, and interface.
virtual bool legal_for_primary_key (void) const;
+
+ // Accessors for the member.
+ AST_StructureFwd *fwd_decl (void) const;
+ void fwd_decl (AST_StructureFwd *node);
// AST Dumping.
virtual void dump (ACE_OSTREAM_TYPE &o);
@@ -183,6 +184,9 @@ private:
int local_struct_;
// We also need to determine whether we contain any local type.
+
+ AST_StructureFwd *fwd_decl_;
+ // The forward declaration we may have been created from.
};
#endif // _AST_STRUCTURE_AST_STRUCTURE_HH
diff --git a/TAO/TAO_IDL/include/ast_structure_fwd.h b/TAO/TAO_IDL/include/ast_structure_fwd.h
index 031b46ab61b..5f82c6f485d 100644
--- a/TAO/TAO_IDL/include/ast_structure_fwd.h
+++ b/TAO/TAO_IDL/include/ast_structure_fwd.h
@@ -15,7 +15,7 @@ class TAO_IDL_FE_Export AST_StructureFwd : public virtual AST_Type
public:
AST_StructureFwd (void);
- AST_StructureFwd (AST_Structure *dummy,
+ AST_StructureFwd (AST_Structure *full_defn,
UTL_ScopedName *n);
virtual ~AST_StructureFwd (void);
@@ -24,6 +24,7 @@ public:
void set_full_definition (AST_Structure *nfd);
virtual bool is_defined (void);
+ void set_as_defined (void);
// Cleanup function.
virtual void destroy (void);
@@ -41,6 +42,9 @@ public:
private:
AST_Structure *pd_full_definition;
// The structure this is a forward declaration of.
+
+ bool is_defined_;
+ // Checking the member above isn't good enough.
};
#endif // _AST_STRUCTURE_FWD_AST_STRUCTURE_FWD_HH
diff --git a/TAO/TAO_IDL/include/ast_typedef.h b/TAO/TAO_IDL/include/ast_typedef.h
index e1fddbea1e5..24d6ff271f0 100644
--- a/TAO/TAO_IDL/include/ast_typedef.h
+++ b/TAO/TAO_IDL/include/ast_typedef.h
@@ -121,6 +121,10 @@ private:
AST_Type *pd_base_type;
// Typedef base type.
+
+ bool owns_base_type_;
+ // If our base type is anonymous array or sequence, we're
+ // responsible for destroying it.
};
#endif // _AST_TYPEDEF_AST_TYPEDEF_HH
diff --git a/TAO/TAO_IDL/include/ast_union_branch.h b/TAO/TAO_IDL/include/ast_union_branch.h
index fc0e8430c7c..ed075ecbe45 100644
--- a/TAO/TAO_IDL/include/ast_union_branch.h
+++ b/TAO/TAO_IDL/include/ast_union_branch.h
@@ -110,6 +110,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_union_label.h b/TAO/TAO_IDL/include/ast_union_label.h
index 7865f71d1aa..580c90d2a2f 100644
--- a/TAO/TAO_IDL/include/ast_union_label.h
+++ b/TAO/TAO_IDL/include/ast_union_label.h
@@ -101,6 +101,9 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
// Data.
diff --git a/TAO/TAO_IDL/include/ast_valuebox.h b/TAO/TAO_IDL/include/ast_valuebox.h
index 5222dbe97be..52f5e22a55f 100644
--- a/TAO/TAO_IDL/include/ast_valuebox.h
+++ b/TAO/TAO_IDL/include/ast_valuebox.h
@@ -30,10 +30,12 @@ public:
// Visiting.
virtual int ast_accept (ast_visitor *visitor);
+
+ // Cleanup.
+ virtual void destroy (void);
protected:
AST_Type *pd_boxed_type;
-
};
#endif // _AST_VALUEBOX_AST_VALUEBOX_HH
diff --git a/TAO/TAO_IDL/include/drv_extern.h b/TAO/TAO_IDL/include/drv_extern.h
index 181d9fd5604..6a4ec26b63b 100644
--- a/TAO/TAO_IDL/include/drv_extern.h
+++ b/TAO/TAO_IDL/include/drv_extern.h
@@ -78,7 +78,7 @@ extern void DRV_store_env_include_paths (void);
extern void DRV_cpp_init (void);
extern void DRV_cpp_post_init (void);
extern void DRV_cpp_putarg (const char *str);
-extern void DRV_cpp_new_location (const char *new_loc);
+extern void DRV_cpp_new_location (char *new_loc);
extern void DRV_get_orb_idl_includes (void);
// Not used by all backends.
diff --git a/TAO/TAO_IDL/include/fe_extern.h b/TAO/TAO_IDL/include/fe_extern.h
index dfb6b597111..e75f5b90ca3 100644
--- a/TAO/TAO_IDL/include/fe_extern.h
+++ b/TAO/TAO_IDL/include/fe_extern.h
@@ -97,4 +97,12 @@ FE_new_UTL_Error (void);
TAO_IDL_FE_Export UTL_Indenter *
FE_new_UTL_Indenter (void);
+// Exception thrown when exiting prematurely in the front end.
+// Also used when command line options limit the output to
+// usage, version or preprocessed files. Catch block is just
+// before front end cleanup and exit.
+class TAO_IDL_FE_Export FE_Bailout
+{
+};
+
#endif // _FE_EXTERN_FE_EXTERN_HH
diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h
index a1914105d42..ce7da6087c1 100644
--- a/TAO/TAO_IDL/include/idl_global.h
+++ b/TAO/TAO_IDL/include/idl_global.h
@@ -346,8 +346,8 @@ public:
virtual UTL_Error *err (void); // Error reporter
virtual void set_err (UTL_Error *); // Set it
- virtual long err_count (void); // How many errors?
- virtual void set_err_count (long); // Set it
+ virtual int err_count (void); // How many errors?
+ virtual void set_err_count (int); // Set it
virtual long lineno (void); // Where in file?
virtual void set_lineno (long); // Set it
@@ -549,7 +549,7 @@ public:
void add_include_path (const char *s);
// Add another path to 'include_paths_'.
- ACE_Hash_Map_Manager<ACE_CString, char *, ACE_Null_Mutex> &
+ ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> &
file_prefixes (void);
// Accessor for the IDL file prefix container.
@@ -594,6 +594,9 @@ public:
const char *recursion_start (void) const;
void recursion_start (const char *val);
// Accessors for the member.
+
+ UTL_String *utl_string_factory (const char *str);
+ // Utility function to create UTL_String classes on the FE heap.
private:
// Data
@@ -602,14 +605,14 @@ private:
AST_Generator *pd_gen; // Store generator
AST_ValueType *pd_primary_key_base; // Store PrimaryKeyBase
UTL_Error *pd_err; // Error object
- long pd_err_count; // Count of errors
+ int pd_err_count; // Count of errors
long pd_lineno; // What line #
UTL_String *pd_filename; // What file
UTL_String *pd_main_filename; // What main filename
UTL_String *pd_real_filename; // What real filename
UTL_String *pd_stripped_filename; // Stripped filename
- bool pd_import; // Is import on?
- bool pd_in_main_file; // Are we in it?
+ bool pd_import; // Is import on?
+ bool pd_in_main_file; // Are we in it?
const char *pd_prog_name; // Argv[0]
const char *pd_cpp_location; // Where to find CPP
long pd_compile_flags; // Compile flags
@@ -673,7 +676,7 @@ private:
ACE_Unbounded_Queue<char *> include_paths_;
// List of -I options passed to us.
- ACE_Hash_Map_Manager<ACE_CString, char *, ACE_Null_Mutex> file_prefixes_;
+ ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> file_prefixes_;
// Associates a prefix with a file.
bool pass_orb_idl_;
diff --git a/TAO/TAO_IDL/include/utl_exceptlist.h b/TAO/TAO_IDL/include/utl_exceptlist.h
index f10b5d575ab..5e36d5e2222 100644
--- a/TAO/TAO_IDL/include/utl_exceptlist.h
+++ b/TAO/TAO_IDL/include/utl_exceptlist.h
@@ -85,6 +85,13 @@ public:
// Get list item.
AST_Exception *head (void);
+
+ // Cleanup.
+ virtual void destroy (void);
+
+ // Copies the UTL_ExceptList pointers but not the
+ // contained AST_Exceptions.
+ virtual UTL_ExceptList *copy (void);
private:
// Data.
diff --git a/TAO/TAO_IDL/include/utl_exprlist.h b/TAO/TAO_IDL/include/utl_exprlist.h
index 53e09c7a500..4b8108bbb58 100644
--- a/TAO/TAO_IDL/include/utl_exprlist.h
+++ b/TAO/TAO_IDL/include/utl_exprlist.h
@@ -88,6 +88,9 @@ public:
// Get list item.
AST_Expression *head (void);
+ // Cleanup.
+ virtual void destroy (void);
+
private:
// Data.
AST_Expression *pd_car_data;
diff --git a/TAO/TAO_IDL/include/utl_labellist.h b/TAO/TAO_IDL/include/utl_labellist.h
index 80b8d8d505f..299cadfe0d2 100644
--- a/TAO/TAO_IDL/include/utl_labellist.h
+++ b/TAO/TAO_IDL/include/utl_labellist.h
@@ -87,6 +87,9 @@ public:
// Get list item.
AST_UnionLabel *head (void);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
AST_UnionLabel *pd_car_data;
diff --git a/TAO/TAO_IDL/include/utl_list.h b/TAO/TAO_IDL/include/utl_list.h
index 3e88833bc7b..b91c98b5a1b 100644
--- a/TAO/TAO_IDL/include/utl_list.h
+++ b/TAO/TAO_IDL/include/utl_list.h
@@ -115,6 +115,7 @@ private:
// Friend class.
friend class UTL_ListActiveIterator;
+ friend class UTL_ExceptList;
};
// Active iterator for lists.
diff --git a/TAO/TAO_IDL/include/utl_namelist.h b/TAO/TAO_IDL/include/utl_namelist.h
index 5ab4995f3e0..56a4f764a22 100644
--- a/TAO/TAO_IDL/include/utl_namelist.h
+++ b/TAO/TAO_IDL/include/utl_namelist.h
@@ -89,6 +89,9 @@ public:
// Accessors.
bool truncatable (void) const;
void truncatable (bool val);
+
+ // Cleanup.
+ virtual void destroy (void);
private:
// List item.
diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h
index 6e22b9a986c..0b74e4422ad 100644
--- a/TAO/TAO_IDL/include/utl_scope.h
+++ b/TAO/TAO_IDL/include/utl_scope.h
@@ -230,11 +230,13 @@ public:
// Name Lookup Mechanism
AST_Decl *lookup_by_name (UTL_ScopedName *,
bool treat_as_ref,
- bool in_parent = 1);
+ bool in_parent = true,
+ bool full_def_only = false);
// Look up the Identifier * specified only in the local scope.
AST_Decl *lookup_by_name_local (Identifier *,
- long index);
+ long index,
+ bool full_def_only = false);
// Look up a predefined type by its ExprType.
AST_Decl *lookup_primitive_type (AST_Expression::ExprType);
diff --git a/TAO/TAO_IDL/tao_idl.cpp b/TAO/TAO_IDL/tao_idl.cpp
index 54ea445086e..a94f27cccb9 100644
--- a/TAO/TAO_IDL/tao_idl.cpp
+++ b/TAO/TAO_IDL/tao_idl.cpp
@@ -83,8 +83,11 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
ACE_RCSID (TAO_IDL,
tao_idl,
"$Id$")
+
+extern char *DRV_arglist[];
+extern unsigned long DRV_argcount;
-const char *DRV_files[NFILES];
+char *DRV_files[NFILES];
long DRV_nfiles = 0;
long DRV_file_index = -1;
@@ -106,7 +109,7 @@ DRV_version (void)
int
DRV_init (int &argc, char *argv[])
{
- // Initialize BE.
+ // Initialize front end.
FE_init ();
// Initialize driver private data
@@ -122,11 +125,6 @@ DRV_init (int &argc, char *argv[])
idl_global->set_cpp_location ("cc");
#endif /* TAO_IDL_PREPROCESSOR */
- // Initialize BE global data object.
- ACE_NEW_RETURN (be_global,
- BE_GlobalData,
- -1);
-
// Does nothing for IDL compiler, stores -ORB args, initializes
// ORB and IFR for IFR loader.
return BE_init (argc, argv);
@@ -140,12 +138,38 @@ DRV_refresh (void)
idl_global->set_main_filename (0);
idl_global->set_real_filename (0);
idl_global->set_stripped_filename (0);
-// idl_global->set_import (true);
-// idl_global->set_in_main_file (false);
idl_global->set_lineno (-1);
idl_global->reset_flag_seen ();
}
+void
+DRV_cleanup (void)
+{
+ // In case we got here via an init error or
+ // usage/version option - otherwise it's idempotent.
+ BE_cleanup ();
+
+ be_global->destroy ();
+ delete be_global;
+ be_global = 0;
+
+ idl_global->fini ();
+ delete idl_global;
+ idl_global = 0;
+
+ for (DRV_file_index = 0;
+ DRV_file_index < DRV_nfiles;
+ ++DRV_file_index)
+ {
+ ACE::strdelete (DRV_files[DRV_file_index]);
+ }
+
+ for (unsigned long i = 0; i < DRV_argcount; ++i)
+ {
+ ACE::strdelete (DRV_arglist[i]);
+ }
+}
+
/*
** Drive the compilation
**
@@ -166,11 +190,7 @@ DRV_drive (const char *s)
{
// Set the name of the IDL file we are parsing. This is useful to
// the backend when it generates C++ headers and files.
- UTL_String *src_file = 0;
- ACE_NEW (src_file,
- UTL_String (s));
-
- idl_global->idl_src_file (src_file);
+ idl_global->idl_src_file (idl_global->utl_string_factory (s));
// Pass through CPP.
if (idl_global->compile_flags () & IDL_CF_INFORMATIVE)
@@ -189,12 +209,14 @@ DRV_drive (const char *s)
{
ACE_DEBUG ((LM_DEBUG,
"%s%s %s\n",
- idl_global->prog_name(),
+ idl_global->prog_name (),
ACE_TEXT (": parsing"),
s));
}
- FE_yyparse ();
+ // Return value not used - error count stored in idl_global
+ // and checked below.
+ (void) FE_yyparse ();
// We must do this as late as possible to make sure any
// forward declared structs or unions contained in a
@@ -216,10 +238,8 @@ DRV_drive (const char *s)
? ACE_TEXT ("s")
: ACE_TEXT ("")))));
- // Call BE_abort to allow a BE to clean up after itself.
- BE_abort ();
-
- ACE_OS::exit (static_cast<int> (idl_global->err_count ()));
+ // Backend will be cleaned up after the exception is caught.
+ throw FE_Bailout ();
}
// Dump the code.
@@ -254,15 +274,14 @@ DRV_drive (const char *s)
// Make sure all forward declared structs and unions are defined
// before proceeding to code generation.
AST_check_fwd_decls ();
- long error_count = idl_global->err_count ();
- if (error_count == 0)
+ if (0 == idl_global->err_count ())
{
BE_produce ();
}
else
{
- ACE_OS::exit (static_cast<int> (error_count));
+ throw FE_Bailout ();
}
DRV_refresh ();
@@ -280,88 +299,87 @@ DRV_drive (const char *s)
int
main (int argc, char *argv[])
{
- // Initialize driver and global variables.
- int init_status = DRV_init (argc, argv);
-
- if (init_status != 0)
- {
- ACE_OS::exit (init_status);
- }
-
- // Parse arguments.
- DRV_parse_args (argc, argv);
-
- // If a version message is requested, print it and exit.
- if (idl_global->compile_flags () & IDL_CF_VERSION)
- {
- DRV_version ();
- ACE_OS::exit (0);
- }
+ // Return status.
+ int status = 0;
- // If a usage message is requested, give it and exit.
- if (idl_global->compile_flags () & IDL_CF_ONLY_USAGE)
+ try
{
- DRV_usage ();
- ACE_OS::exit (0);
+ // Initialize driver and global variables.
+ status = DRV_init (argc, argv);
+
+ if (0 != status)
+ {
+ throw FE_Bailout ();
+ }
+
+ // Parse arguments.
+ DRV_parse_args (argc, argv);
+
+ // If a version message is requested, print it and exit.
+ if (idl_global->compile_flags () & IDL_CF_VERSION)
+ {
+ DRV_version ();
+ throw FE_Bailout ();
+ }
+
+ // If a usage message is requested, give it and exit.
+ if (idl_global->compile_flags () & IDL_CF_ONLY_USAGE)
+ {
+ DRV_usage ();
+ throw FE_Bailout ();
+ }
+
+ // If there are no input files, and we are not using the
+ // directory recursion option, there's no sense going any further.
+ if (0 == DRV_nfiles && 0 == idl_global->recursion_start ())
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("IDL: No input files\n")));
+
+ ++status;
+ throw FE_Bailout ();
+ }
+
+ AST_Generator *gen = be_global->generator_init ();
+
+ if (0 == gen)
+ {
+ ACE_ERROR ((
+ LM_ERROR,
+ ACE_TEXT ("IDL: DRV_generator_init() failed to create ")
+ ACE_TEXT ("generator, exiting\n")
+ ));
+
+ ++status;
+ throw FE_Bailout ();
+ }
+ else
+ {
+ idl_global->set_gen (gen);
+ }
+
+ // Initialize AST and load predefined types.
+ FE_populate ();
+
+ // Does various things in various backends.
+ BE_post_init (DRV_files, DRV_nfiles);
+
+ for (DRV_file_index = 0;
+ DRV_file_index < DRV_nfiles;
+ ++DRV_file_index)
+ {
+ DRV_drive (DRV_files[DRV_file_index]);
+ }
}
-
- // If there are no input files, and we are not using the
- // directory recursion option, there's no sense going any further.
- if (DRV_nfiles == 0 && idl_global->recursion_start () == 0)
+ catch (FE_Bailout)
{
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("IDL: No input files\n")));
-
- ACE_OS::exit (99);
}
-
- AST_Generator *gen = be_global->generator_init ();
-
- if (gen == 0)
- {
- ACE_ERROR ((
- LM_ERROR,
- ACE_TEXT ("IDL: DRV_generator_init() failed to create ")
- ACE_TEXT ("generator, exiting\n")
- ));
-
- ACE_OS::exit (99);
- }
- else
- {
- idl_global->set_gen (gen);
- }
-
- // Initialize AST and load predefined types.
- FE_populate ();
-
- // Does various things in various backends.
- BE_post_init (DRV_files, DRV_nfiles);
-
- for (DRV_file_index = 0;
- DRV_file_index < DRV_nfiles;
- ++DRV_file_index)
- {
- DRV_drive (DRV_files[DRV_file_index]);
- }
-
- be_global->destroy ();
- delete be_global;
- be_global = 0;
-
- idl_global->fini ();
- delete idl_global;
- idl_global = 0;
-
- for (DRV_file_index = 0;
- DRV_file_index < DRV_nfiles;
- ++DRV_file_index)
- {
- ACE::strdelete (const_cast<char *> (DRV_files[DRV_file_index]));
- }
-
- ACE_OS::exit (0);
-
- // NOT REACHED
- return 0;
+
+ // Case 1: init error, status = 1, nothing added here.
+ // Case 2: other error(s), status = 0, error count added here.
+ status += idl_global->err_count ();
+
+ DRV_cleanup ();
+
+ return status;
}
diff --git a/TAO/TAO_IDL/util/utl_exceptlist.cpp b/TAO/TAO_IDL/util/utl_exceptlist.cpp
index e3c1c6b2e7e..67aa6a53fbf 100644
--- a/TAO/TAO_IDL/util/utl_exceptlist.cpp
+++ b/TAO/TAO_IDL/util/utl_exceptlist.cpp
@@ -76,6 +76,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "utl_exceptlist.h"
+#include "ace/OS_Memory.h"
+
ACE_RCSID (util,
utl_exceptlist,
"$Id$")
@@ -94,6 +96,39 @@ UTL_ExceptList::head (void)
return this->pd_car_data;
}
+// The two methods below make direct calls on the
+// cdr list (we have been made a friend of the base
+// class UTL_List's private member). This is so we
+// can avoid copying the contained quantity, an
+// AST_Exception.
+
+void
+UTL_ExceptList::destroy (void)
+{
+ if (this->pd_cdr_data != 0)
+ {
+ this->pd_cdr_data->destroy ();
+ }
+
+ delete this;
+}
+
+UTL_ExceptList *
+UTL_ExceptList::copy (void)
+{
+ UTL_ExceptList *retval = 0;
+ ACE_NEW_RETURN (retval,
+ UTL_ExceptList (
+ this->pd_car_data,
+ this->pd_cdr_data != 0
+ ? (UTL_ExceptList *) this->pd_cdr_data->copy ()
+ : 0
+ ),
+ 0);
+
+ return retval;
+}
+
UTL_ExceptlistActiveIterator::UTL_ExceptlistActiveIterator (UTL_ExceptList *s)
: UTL_ListActiveIterator(s)
{
diff --git a/TAO/TAO_IDL/util/utl_exprlist.cpp b/TAO/TAO_IDL/util/utl_exprlist.cpp
index 2f96cded1b5..b92a47df701 100644
--- a/TAO/TAO_IDL/util/utl_exprlist.cpp
+++ b/TAO/TAO_IDL/util/utl_exprlist.cpp
@@ -72,7 +72,8 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// will cease to operate correctly if you use either multiple or
// public virtual inheritance.
-#include "utl_exprlist.h"
+#include "utl_exprlist.h"
+#include "ast_expression.h"
ACE_RCSID (util,
utl_exprlist,
@@ -80,8 +81,8 @@ ACE_RCSID (util,
UTL_ExprList::UTL_ExprList (AST_Expression *s,
UTL_ExprList *cdr)
- : UTL_List(cdr),
- pd_car_data(s)
+ : UTL_List (cdr),
+ pd_car_data (s)
{
}
@@ -92,6 +93,19 @@ UTL_ExprList::head (void)
return this->pd_car_data;
}
+void
+UTL_ExprList::destroy (void)
+{
+ if (this->pd_car_data != 0)
+ {
+ this->pd_car_data->destroy ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
+ }
+
+ this->UTL_List::destroy ();
+}
+
UTL_ExprlistActiveIterator::UTL_ExprlistActiveIterator (UTL_ExprList *s)
: UTL_ListActiveIterator(s)
{
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 4fa1996aa22..68dce4e6b48 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -318,14 +318,14 @@ IDL_GlobalData::set_err (UTL_Error *e)
}
// Get or set error count
-long
+int
IDL_GlobalData::err_count (void)
{
return this->pd_err_count;
}
void
-IDL_GlobalData::set_err_count (long c)
+IDL_GlobalData::set_err_count (int c)
{
this->pd_err_count = c;
}
@@ -621,7 +621,7 @@ IDL_GlobalData::n_include_file_names (void)
// IDL file.
void
-IDL_GlobalData::add_to_included_idl_files (char* file_name)
+IDL_GlobalData::add_to_included_idl_files (char *file_name)
{
// Let's avoid duplicates.
for (size_t index = 0; index < this->n_included_idl_files_; ++index)
@@ -664,7 +664,8 @@ IDL_GlobalData::add_to_included_idl_files (char* file_name)
}
// Store it.
- this->included_idl_files_ [this->n_included_idl_files_++] = file_name;
+ this->included_idl_files_ [this->n_included_idl_files_++] =
+ ACE::strnew (file_name);
}
char**
@@ -1047,11 +1048,12 @@ IDL_GlobalData::destroy (void)
trash = 0;
}
+ // Clean up each included file name - the array allocation itself
+ // gets cleaned up in fini().
for (unsigned long j = 0; j < this->pd_n_include_file_names; ++j)
{
- // Delete the contained char* but not the UTL_String -
- // we can leave the slots allocated and clean up later.
this->pd_include_file_names[j]->destroy ();
+ delete this->pd_include_file_names[j];
this->pd_include_file_names[j] = 0;
}
@@ -1059,16 +1061,22 @@ IDL_GlobalData::destroy (void)
for (size_t k = 0; k < n_included_idl_files_; ++k)
{
- // No memory allocated for these, so just set to 0.
+ ACE::strdelete (this->included_idl_files_[k]);
this->included_idl_files_[k] = 0;
}
this->n_included_idl_files_ = 0;
-
- this->pd_root->destroy ();
+ this->n_allocated_idl_files_ = 0;
+ delete [] this->included_idl_files_;
+ this->included_idl_files_ = 0;
ACE::strdelete (this->recursion_start_);
this->recursion_start_ = 0;
+
+ if (0 != this->pd_root)
+ {
+ this->pd_root->destroy ();
+ }
}
void
@@ -1121,10 +1129,10 @@ IDL_GlobalData::update_prefix (char *filename)
ACE_CString tmp ("", 0, 0);
char *main_filename = this->pd_main_filename->get_string ();
- ACE_CString ext_id (filename);
+// ACE_CString ext_id (filename);
char *prefix = 0;
- int status = this->file_prefixes_.find (ext_id, prefix);
+ int status = this->file_prefixes_.find (filename, prefix);
if (status == 0)
{
@@ -1133,9 +1141,8 @@ IDL_GlobalData::update_prefix (char *filename)
else
{
prefix = ACE::strnew ("");
- (void) this->file_prefixes_.bind (ext_id, prefix);
- char *tmp = const_cast<char *> ("");
- this->pd_root->prefix (tmp);
+ (void) this->file_prefixes_.bind (ACE::strnew (filename), prefix);
+ this->pd_root->prefix ("");
}
// The first branch is executed if we are finishing an
@@ -1315,7 +1322,7 @@ IDL_GlobalData::add_include_path (const char *s)
this->include_paths_.enqueue_tail (ACE::strnew (s));
}
-ACE_Hash_Map_Manager<ACE_CString, char *, ACE_Null_Mutex> &
+ACE_Hash_Map_Manager<char *, char *, ACE_Null_Mutex> &
IDL_GlobalData::file_prefixes (void)
{
return this->file_prefixes_;
@@ -1468,10 +1475,13 @@ IDL_GlobalData::check_gperf (void)
void
IDL_GlobalData::fini (void)
{
- this->pd_root->fini ();
- delete this->pd_root;
- this->pd_root = 0;
-
+ if (0 != this->pd_root)
+ {
+ this->pd_root->fini ();
+ delete this->pd_root;
+ this->pd_root = 0;
+ }
+
delete this->pd_err;
this->pd_err = 0;
delete this->pd_gen;
@@ -1488,6 +1498,33 @@ IDL_GlobalData::fini (void)
this->temp_dir_ = 0;
delete [] this->ident_string_;
this->ident_string_ = 0;
+ delete [] this->pd_include_file_names;
+ this->pd_include_file_names = 0;
+
+ char **path_tmp = 0;
+
+ for (ACE_Unbounded_Queue_Iterator<char *>qiter (
+ this->include_paths_
+ );
+ !qiter.done ();
+ qiter.advance ())
+ {
+ qiter.next (path_tmp);
+ ACE::strdelete (*path_tmp);
+ }
+
+ ACE_Hash_Map_Entry<char *, char *> *entry = 0;
+
+ for (ACE_Hash_Map_Iterator<char *, char *, ACE_Null_Mutex> hiter (
+ this->file_prefixes_
+ );
+ !hiter.done ();
+ hiter.advance ())
+ {
+ hiter.next (entry);
+ ACE::strdelete (entry->ext_id_);
+ ACE::strdelete (entry->int_id_);
+ }
}
void
@@ -1650,12 +1687,18 @@ IDL_GlobalData::recursion_start (const char *val)
this->recursion_start_ = ACE::strnew (val);
}
+UTL_String *
+IDL_GlobalData::utl_string_factory (const char *str)
+{
+ return new UTL_String (str);
+}
+
void
-IDL_GlobalData::add_dcps_data_type(const char* id)
+IDL_GlobalData::add_dcps_data_type (const char* id)
{
// Check if the type already exists.
DCPS_Data_Type_Info* newinfo ;
- if (this->dcps_type_info_map_.find( id, newinfo) != 0)
+ if (this->dcps_type_info_map_.find (id, newinfo) != 0)
{
// No existing entry, add one.
@@ -1664,63 +1707,67 @@ IDL_GlobalData::add_dcps_data_type(const char* id)
ACE_NEW (foo_type, char [ACE_OS::strlen (id) + 2]);
ACE_OS::sprintf (foo_type, "%s ", id);
- UTL_ScopedName* t1 = idl_global->string_to_scoped_name(foo_type);
+ UTL_ScopedName* t1 = idl_global->string_to_scoped_name (foo_type);
// chained with null Identifier required!!
- UTL_ScopedName* target = new UTL_ScopedName(new Identifier(""),t1);
+ UTL_ScopedName* target = new UTL_ScopedName (new Identifier (""), t1);
- newinfo = new DCPS_Data_Type_Info();
+ newinfo = new DCPS_Data_Type_Info ();
newinfo->name_ = target;
// Add the newly formed entry to the map.
if (this->dcps_type_info_map_.bind( id, newinfo) != 0)
{
- ACE_ERROR((LM_ERROR,
- ACE_TEXT("(%P|%t) Unable to insert type into DCPS type container: %s.\n"),
- id
- ));
- return ;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Unable to insert type")
+ ACE_TEXT (" into DCPS type container: %s.\n"),
+ id));
+ return;
}
}
else
{
- ACE_ERROR((LM_WARNING,ACE_TEXT("(%P|%t) Duplicate DCPS type defined: %s.\n"),id));
+ ACE_ERROR ((LM_WARNING,
+ ACE_TEXT ("(%P|%t) Duplicate DCPS type defined: %s.\n"),
+ id));
}
}
bool
-IDL_GlobalData::add_dcps_data_key(const char* id, const char* key)
+IDL_GlobalData::add_dcps_data_key (const char* id, const char* key)
{
// Search the map for the type.
- DCPS_Data_Type_Info* newinfo ;
- if (this->dcps_type_info_map_.find( id, newinfo) == 0)
+ DCPS_Data_Type_Info* newinfo = 0;
+
+ if (this->dcps_type_info_map_.find (id, newinfo) == 0)
{
// Add the new key field to the type.
- newinfo->key_list_.enqueue_tail(key);
+ newinfo->key_list_.enqueue_tail (key);
return true;
}
else
{
ACE_ERROR((LM_ERROR,
- "missing previous #pragma DCPS_DATA_TYPE n"));
+ ACE_TEXT ("missing previous #pragma DCPS_DATA_TYPE\n")));
}
+
return false;
}
IDL_GlobalData::DCPS_Data_Type_Info*
-IDL_GlobalData::is_dcps_type(UTL_ScopedName* target)
+IDL_GlobalData::is_dcps_type (UTL_ScopedName* target)
{
// Traverse the entire map.
DCPS_Type_Info_Map::ENTRY* entry ;
- for (DCPS_Type_Info_Map::ITERATOR current( this->dcps_type_info_map_) ;
- current.next(entry) ;
- current.advance())
+ for (DCPS_Type_Info_Map::ITERATOR current (this->dcps_type_info_map_);
+ current.next (entry);
+ current.advance ())
{
// Look for our Identifier.
- if (0 == entry->int_id_->name_->compare( target))
+ if (0 == entry->int_id_->name_->compare (target))
{
// Found it!
- return entry->int_id_ ;
+ return entry->int_id_;
}
}
diff --git a/TAO/TAO_IDL/util/utl_idlist.cpp b/TAO/TAO_IDL/util/utl_idlist.cpp
index 26985395686..520036950bf 100644
--- a/TAO/TAO_IDL/util/utl_idlist.cpp
+++ b/TAO/TAO_IDL/util/utl_idlist.cpp
@@ -247,6 +247,7 @@ UTL_IdList::destroy (void)
{
if (this->pd_car_data != 0)
{
+ this->pd_car_data->destroy ();
delete this->pd_car_data;
this->pd_car_data = 0;
}
diff --git a/TAO/TAO_IDL/util/utl_labellist.cpp b/TAO/TAO_IDL/util/utl_labellist.cpp
index 8241f3c63c7..bab64bb4e15 100644
--- a/TAO/TAO_IDL/util/utl_labellist.cpp
+++ b/TAO/TAO_IDL/util/utl_labellist.cpp
@@ -73,6 +73,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
// public virtual inheritance.
#include "utl_labellist.h"
+#include "ast_union_label.h"
ACE_RCSID (util,
utl_labellist,
@@ -92,6 +93,16 @@ UTL_LabelList::head (void)
return this->pd_car_data;
}
+void
+UTL_LabelList::destroy (void)
+{
+ this->pd_car_data->destroy ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
+
+ this->UTL_List::destroy ();
+}
+
UTL_LabellistActiveIterator::UTL_LabellistActiveIterator (UTL_LabelList *s)
: UTL_ListActiveIterator (s)
{
diff --git a/TAO/TAO_IDL/util/utl_list.cpp b/TAO/TAO_IDL/util/utl_list.cpp
index 1e1f23a0657..a52dd4bde8f 100644
--- a/TAO/TAO_IDL/util/utl_list.cpp
+++ b/TAO/TAO_IDL/util/utl_list.cpp
@@ -150,6 +150,7 @@ void
UTL_List::set_tail (UTL_List *l)
{
this->pd_cdr_data->destroy ();
+ delete this->pd_cdr_data;
this->pd_cdr_data = l;
}
diff --git a/TAO/TAO_IDL/util/utl_namelist.cpp b/TAO/TAO_IDL/util/utl_namelist.cpp
index e88da13f0f0..37f6020cfa6 100644
--- a/TAO/TAO_IDL/util/utl_namelist.cpp
+++ b/TAO/TAO_IDL/util/utl_namelist.cpp
@@ -105,6 +105,16 @@ UTL_NameList::truncatable (bool val)
this->pd_truncatable = val;
}
+void
+UTL_NameList::destroy (void)
+{
+ this->pd_car_data->destroy ();
+ delete this->pd_car_data;
+ this->pd_car_data = 0;
+
+ this->UTL_List::destroy ();
+}
+
UTL_NamelistActiveIterator::UTL_NamelistActiveIterator (UTL_NameList *s)
: UTL_ListActiveIterator(s)
{
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index ac011b7d84f..3ff9e4c4cad 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -100,6 +100,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "ast_factory.h"
#include "ast_visitor.h"
#include "nr_extern.h"
+#include "fe_extern.h"
#include "global_extern.h"
#include "ace/OS_NS_strings.h"
@@ -159,7 +160,8 @@ is_global_name (Identifier *i)
static AST_Decl *
iter_lookup_by_name_local (AST_Decl *d,
UTL_ScopedName *e,
- long index)
+ long index,
+ bool full_def_only = false)
{
AST_Typedef *td = AST_Typedef::narrow_from_decl (d);
AST_Decl *result = 0;
@@ -192,7 +194,8 @@ iter_lookup_by_name_local (AST_Decl *d,
{
// Look up the first component of the scoped name.
result = sc->lookup_by_name_local (e->head (),
- index);
+ index,
+ full_def_only);
}
else
{
@@ -218,7 +221,8 @@ iter_lookup_by_name_local (AST_Decl *d,
// Look up the next component of the scoped name.
result = iter_lookup_by_name_local (result,
sn,
- 0);
+ 0,
+ full_def_only);
}
if (result != 0)
@@ -235,7 +239,8 @@ iter_lookup_by_name_local (AST_Decl *d,
// to lookup_by_name_local will catch it and return 0.
return iter_lookup_by_name_local (d,
e,
- index + 1);
+ index + 1,
+ full_def_only);
}
}
}
@@ -1578,12 +1583,15 @@ UTL_Scope::look_in_supported (UTL_ScopedName *,
// Look up a String * in local scope only.
AST_Decl *
UTL_Scope::lookup_by_name_local (Identifier *e,
- long index)
+ long index,
+ bool full_def_only)
{
if (index > 0 && index == (long) this->nmembers ())
{
return 0;
}
+
+ AST_Type *t = 0;
// Will return 0 unless looking up 'Object' or 'TypeCode'.
AST_Decl *d = this->lookup_pseudo (e);
@@ -1653,6 +1661,13 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
d = AST_StructureFwd::narrow_from_decl (d)->full_definition ();
}
+ t = (0 == d ? 0 : AST_Type::narrow_from_decl (d));
+
+ if (0 != t && full_def_only && !t->is_defined ())
+ {
+ continue;
+ }
+
return d;
}
else
@@ -1670,13 +1685,21 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
// OK, not found, check if this scope is a module, and if so,
// look in previous openings, if any.
- d = ScopeAsDecl (this);
+ AST_Decl *last_chance = ScopeAsDecl (this);
- if (d->node_type () == AST_Decl::NT_module)
+ if (last_chance->node_type () == AST_Decl::NT_module)
{
- AST_Module *m = AST_Module::narrow_from_decl (d);
-
- return m->look_in_previous (e);
+ // Check the result using the full_def_only constraint.
+ AST_Module *m = AST_Module::narrow_from_decl (last_chance);
+ d = m->look_in_previous (e);
+ t = (0 == d ? 0 : AST_Type::narrow_from_decl (d));
+
+ if (0 != t && full_def_only && !t->is_defined ())
+ {
+ return 0;
+ }
+
+ return d;
}
else
{
@@ -1688,10 +1711,12 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
AST_Decl *
UTL_Scope::lookup_by_name (UTL_ScopedName *e,
bool treat_as_ref,
- bool in_parent)
+ bool in_parent,
+ bool full_def_only)
{
AST_Decl *d = 0;
- UTL_Scope *t = 0;
+ UTL_Scope *s = 0;
+ AST_Type *t = 0;
// Empty name? Error.
if (e == 0)
@@ -1705,29 +1730,31 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// Get parent scope.
d = ScopeAsDecl (this);
- if (d == 0)
+ if (0 == d)
{
return 0;
}
- t = d->defined_in ();
+ s = d->defined_in ();
// If this is the global scope..
- if (t == 0)
+ if (0 == s)
{
// Look up tail of name starting here.
d = lookup_by_name ((UTL_ScopedName *) e->tail (),
treat_as_ref,
- in_parent);
+ in_parent,
+ full_def_only);
// Now return whatever we have.
return d;
}
// OK, not global scope yet, so simply iterate with parent scope.
- d = t->lookup_by_name (e,
+ d = s->lookup_by_name (e,
treat_as_ref,
- in_parent);
+ in_parent,
+ full_def_only);
// If treat_as_ref is true and d is not NULL, add d to
// set of nodes referenced here.
@@ -1746,41 +1773,54 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// Is name defined here?
long index = 0;
- while (1)
+ while (true)
{
- d = lookup_by_name_local (e->head (),
- index);
+ d = this->lookup_by_name_local (e->head (),
+ index,
+ full_def_only);
- if (d == 0)
+ if (0 == d)
{
// A no-op unless d can inherit.
d = look_in_inherited (e, treat_as_ref);
-
- if (d == 0)
+
+ if (0 == d)
{
// A no-op unless d can support interfaces.
d = look_in_supported (e, treat_as_ref);
}
-
- if ((d == 0) && in_parent && idl_global->err_count () == 0)
+
+ if (0 == d && this->pd_scope_node_type == AST_Decl::NT_module)
{
+ // Check this result using the full_def_only constraint.
+ d = this->look_in_previous (e->head (), true);
+ t = (0 == d ? 0 : AST_Type::narrow_from_decl (d));
+
+ if (0 != t && full_def_only && !t->is_defined ())
+ {
+ d = 0;
+ }
+ }
+ if ((0 == d) && in_parent && idl_global->err_count () == 0)
+ {
// OK, not found. Go down parent scope chain.
d = ScopeAsDecl (this);
if (d != 0)
{
- t = d->defined_in ();
+ s = d->defined_in ();
- if (t == 0)
+ if (0 == s)
{
d = 0;
}
else
{
- d = t->lookup_by_name (e,
+ d = s->lookup_by_name (e,
treat_as_ref,
- in_parent);
+ in_parent,
+ full_def_only);
}
}
}
@@ -1789,7 +1829,7 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// set of nodes referenced here.
if (treat_as_ref && d != 0)
{
- AST_Type *t = AST_Type::narrow_from_decl (d);
+ t = AST_Type::narrow_from_decl (d);
// Are we a type, rather than an identifier?
if (t != 0)
@@ -1797,11 +1837,11 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// Are we defined in this scope or just referenced?
if (d->defined_in () == this)
{
- UTL_Scope *s = ScopeAsDecl (this)->defined_in ();
+ UTL_Scope *ds = ScopeAsDecl (this)->defined_in ();
- if (s != 0)
+ if (ds != 0)
{
- AST_Decl *parent = ScopeAsDecl (s);
+ AST_Decl *parent = ScopeAsDecl (ds);
AST_Decl::NodeType nt = parent->node_type ();
// If the scope we are defined in is itself
@@ -1812,25 +1852,25 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
while (nt != AST_Decl::NT_module
&& nt != AST_Decl::NT_root)
{
- s->add_to_referenced (d,
- false,
- d->local_name ());
+ ds->add_to_referenced (d,
+ false,
+ d->local_name ());
- s = parent->defined_in ();
- parent = ScopeAsDecl (s);
+ ds = parent->defined_in ();
+ parent = ScopeAsDecl (ds);
nt = parent->node_type ();
}
}
}
}
}
-
+
// OK, now return whatever we found.
return d;
}
// For the possible call to look_in_inherited() below.
- t = DeclAsScope (d);
+ s = DeclAsScope (d);
// OK, start of name is defined. Now loop doing local lookups
// of subsequent elements of the name, if any.
@@ -1840,7 +1880,8 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
{
d = iter_lookup_by_name_local (d,
sn,
- 0);
+ 0,
+ full_def_only);
}
// If the start of the scoped name is an interface, and the
@@ -1850,7 +1891,7 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// of the scope (interface) we started the lookup from.
if (d == 0)
{
- d = t->look_in_inherited (sn, treat_as_ref);
+ d = s->look_in_inherited (sn, treat_as_ref);
}
// If treat_as_ref is true and d is not 0, add d to
@@ -1933,7 +1974,6 @@ UTL_Scope::add_to_referenced (AST_Decl *e,
}
delete [] this->pd_referenced;
-
this->pd_referenced = tmp;
}
@@ -2084,7 +2124,7 @@ UTL_Scope::add_to_scope (AST_Decl *e,
ref_string);
// if we try to continue from here, we risk a crash.
- ACE_OS::exit (99);
+ throw FE_Bailout ();
}
// If the spellings differ only by case, it's also an error,
// unless one, but not both of the identifiers were escaped.
@@ -2098,7 +2138,7 @@ UTL_Scope::add_to_scope (AST_Decl *e,
// if we try to continue from here, we risk a crash.
- ACE_OS::exit (99);
+ throw FE_Bailout ();
}
else
{
@@ -2128,7 +2168,7 @@ UTL_Scope::add_to_scope (AST_Decl *e,
);
// if we try to continue from here, we risk a crash.
- ACE_OS::exit (99);
+ throw FE_Bailout ();
}
else if (decl_name->case_compare_quiet (parent_name) == true)
{
@@ -2140,7 +2180,7 @@ UTL_Scope::add_to_scope (AST_Decl *e,
);
// if we try to continue from here, we risk a crash.
- ACE_OS::exit (99);
+ throw FE_Bailout ();
}
else
{
@@ -2249,7 +2289,7 @@ UTL_Scope::referenced (AST_Decl *e,
// Are we definging a forward declared struct, union, or interface,
// or reopening a module?
bool forward_redef = this->redef_clash (e->node_type (),
- (*tmp)->node_type ());
+ (*tmp)->node_type ());
if (forward_redef == false)
{
@@ -2408,26 +2448,42 @@ void
UTL_Scope::destroy (void)
{
for (UTL_ScopeActiveIterator iter (this, IK_both);
- !iter.is_done ();
- iter.next ())
+ !iter.is_done ();
+ iter.next ())
{
- AST_Decl *i = iter.item ();
- i->destroy ();
- delete i;
- i = 0;
+ AST_Decl *d = iter.item ();
+ d->destroy ();
+ delete d;
+ d = 0;
}
delete [] this->pd_decls;
this->pd_decls = 0;
+ this->pd_decls_used = 0;
+ this->pd_locals_used = 0;
+
+ for (long i = this->pd_name_referenced_used; i > 0; --i)
+ {
+ Identifier *id = this->pd_name_referenced[i - 1];
+ id->destroy ();
+ delete id;
+ id = 0;
+ }
+
+ delete [] this->pd_name_referenced;
+ this->pd_name_referenced = 0;
+ this->pd_name_referenced_allocated = 0;
+ this->pd_name_referenced_used = 0;
delete [] this->pd_local_types;
this->pd_local_types = 0;
+ this->pd_locals_allocated = 0;
+ this->pd_locals_used = 0;
delete [] this->pd_referenced;
this->pd_referenced = 0;
-
- delete [] this->pd_name_referenced;
- this->pd_name_referenced = 0;
+ this->pd_referenced_allocated = 0;
+ this->pd_referenced_used = 0;
}
// Narrowing.
diff --git a/TAO/TAO_IDL/util/utl_string.cpp b/TAO/TAO_IDL/util/utl_string.cpp
index 067f26d0820..3b709d12d13 100644
--- a/TAO/TAO_IDL/util/utl_string.cpp
+++ b/TAO/TAO_IDL/util/utl_string.cpp
@@ -66,6 +66,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
#include "utl_string.h"
#include "global_extern.h"
+#include "fe_extern.h"
#include "utl_err.h"
// FUZZ: disable check_for_streams_include
@@ -95,7 +96,7 @@ UTL_String::UTL_String (const char *str)
else
{
this->len = ACE_OS::strlen (str);
- this->p_str = ACE_OS::strdup (str);
+ this->p_str = ACE::strnew (str);
this->c_str = (char *) ACE_OS::malloc (this->len + 1);
this->canonicalize ();
}
@@ -122,7 +123,7 @@ UTL_String::UTL_String (UTL_String *s)
else
{
this->len = ACE_OS::strlen (b);
- this->p_str = ACE_OS::strdup (b);
+ this->p_str = ACE::strnew (b);
this->c_str = (char *) ACE_OS::malloc (this->len + 1);
this->canonicalize ();
}
@@ -185,8 +186,8 @@ UTL_String::compare (UTL_String *s)
idl_global->err ()->name_case_error (this->p_str,
s->get_string ());
- // if we try to continue from here, we risk a crash.
- ACE_OS::exit (99);
+ // If we try to continue from here, we risk a crash.
+ throw FE_Bailout ();
}
else
{
@@ -231,7 +232,7 @@ UTL_String::destroy (void)
{
if (this->p_str != 0)
{
- ACE_OS::free (this->p_str);
+ ACE::strdelete (this->p_str);
this->p_str = 0;
}