diff options
Diffstat (limited to 'TAO/TAO_IDL/fe/idl.ypp')
-rw-r--r-- | TAO/TAO_IDL/fe/idl.ypp | 72 |
1 files changed, 57 insertions, 15 deletions
diff --git a/TAO/TAO_IDL/fe/idl.ypp b/TAO/TAO_IDL/fe/idl.ypp index 923357f130c..f0b51967b8b 100644 --- a/TAO/TAO_IDL/fe/idl.ypp +++ b/TAO/TAO_IDL/fe/idl.ypp @@ -399,15 +399,17 @@ at_least_one_definition : definitions at_least_one_annotation definition { AST_Decl *d = $3; + AST_Annotation_Appls *annotations = $2; if (d) { - d->annotation_appls ($2); + d->annotation_appls (*annotations); } else { idl_global->err ()-> unsupported_warning( "Annotating this type of definition is not supported"); } + delete annotations; } | definitions definition { @@ -1478,6 +1480,7 @@ state_member } } } + delete $2; } ; @@ -2320,7 +2323,7 @@ annotation_member AST_Expression::ExprType type = $1; Identifier *name = $2; - UTL_ScopedName scoped_name (name, 0); + UTL_ScopedName *scoped_name = new UTL_ScopedName (name, 0); AST_Expression *default_value = $3; AST_Decl * type_obj; @@ -2338,12 +2341,15 @@ annotation_member } FE_Declarator *declarator = new FE_Declarator ( - &scoped_name, FE_Declarator::FD_simple, 0); + scoped_name, FE_Declarator::FD_simple, 0); AST_Annotation_Member *member = idl_global->gen ()-> create_annotation_member ( type, declarator->compose (type_obj), declarator->name ()); scope->fe_add_annotation_member (member); + declarator->destroy (); + delete declarator; + if (default_value) { // Check if types are compatible, else report error @@ -2381,7 +2387,7 @@ at_least_one_annotation AST_Annotation_Appl *annotation = $2; if (annotation) { - annotations->push_back (annotation); + annotations->add (annotation); } $$ = annotations; } @@ -2394,7 +2400,7 @@ annotations_maybe AST_Annotation_Appl *annotation = $2; if (annotation) { - annotations->push_back (annotation); + annotations->add (annotation); } $$ = annotations; } @@ -2472,6 +2478,16 @@ annotation_appl appl->apply_from (decl); idl_global->scopes ().pop (); } + else + { + AST_Annotation_Appl::delete_params (params); + } + + if (name) + { + name->destroy (); + delete name; + } $$ = appl; } @@ -3025,14 +3041,17 @@ members member : annotations_maybe member_i { - if ($1) + AST_Annotation_Appls *annotations = $1; + AST_Decls *members = $2; + if (annotations && members) { - AST_Decls &decls = *$2; - for (size_t i = 0; i < decls.size (); i++) + for (size_t i = 0; i < members->size (); i++) { - decls[i]->annotation_appls ($1); + (*members)[i]->annotation_appls (*annotations); } } + delete annotations; + delete members; } ; @@ -3174,6 +3193,7 @@ union_type */ UTL_Scope *top = idl_global->scopes ().top_non_null (); idl_global->scopes ().pop (); + AST_Annotation_Appls *disc_annotations = $6; UTL_Scope *s = idl_global->scopes ().top_non_null (); UTL_ScopedName n ($1, 0); @@ -3204,7 +3224,7 @@ union_type AST_Union *e = AST_Union::narrow_from_scope (top); e->redefine (u); - e->disc_annotations ($6); // Set Discriminator Annotations + e->disc_annotations (*disc_annotations); // Set Discriminator Annotations u->destroy (); delete u; @@ -3219,6 +3239,8 @@ union_type $1->destroy (); delete $1; $1 = 0; + + delete disc_annotations; } '{' { @@ -3413,6 +3435,7 @@ case_branch : { UTL_Scope *s = idl_global->scopes ().top_non_null (); AST_UnionBranch *b = 0; + AST_Annotation_Appls *annotations = $3; AST_Field *f = $4; idl_global->set_parse_state (IDL_GlobalData::PS_UnionElemCompleted); @@ -3428,7 +3451,7 @@ case_branch : f->field_type (), f->name () ); - b->annotation_appls ($3); + b->annotation_appls (*annotations); (void) s->fe_add_union_branch (b); // f has passed its field type to the union branch, @@ -3437,6 +3460,8 @@ case_branch : delete f; f = 0; } + + delete annotations; } | error { @@ -3697,6 +3722,7 @@ enumerator : annotations_maybe IDENTIFIER { UTL_Scope *s = idl_global->scopes ().top_non_null (); + AST_Annotation_Appls *annotations = $1; Identifier id ($2); ACE::strdelete ($2); $2 = 0; @@ -3720,11 +3746,13 @@ enumerator : &n ); e->enum_parent (c); - e->annotation_appls ($1); + e->annotation_appls (*annotations); } (void) s->fe_add_enum_val (e); } + + delete annotations; } ; @@ -3808,7 +3836,7 @@ sequence_type_spec s->is_local (), s->is_abstract () ); - seq->base_type_annotations (type_annotations); + seq->base_type_annotations (*type_annotations); if (!idl_global->in_typedef () && !idl_global->anon_silent ()) @@ -3818,6 +3846,7 @@ sequence_type_spec } } + delete type_annotations; delete ev; ev = 0; $$ = seq; @@ -3876,7 +3905,7 @@ sequence_type_spec s->is_local (), s->is_abstract () ); - seq->base_type_annotations (type_annotations); + seq->base_type_annotations (*type_annotations); if (!idl_global->in_typedef () && !idl_global->anon_silent ()) @@ -3886,6 +3915,7 @@ sequence_type_spec } } + delete type_annotations; $$ = seq; } ; @@ -4109,7 +4139,7 @@ array_declarator : 0, 0 ); - array->base_type_annotations (base_type_annotations); + array->base_type_annotations (*base_type_annotations); sn.destroy (); if (!idl_global->in_typedef () @@ -4122,6 +4152,8 @@ array_declarator : array_dims->destroy (); delete array_dims; + delete base_type_annotations; + $$ = array; } ; @@ -4519,6 +4551,8 @@ operation : * Push the operation scope onto the scopes stack. */ idl_global->scopes ().push (o); + + delete $4; } parameter_list { @@ -4633,6 +4667,8 @@ init_decl * Push the operation scope onto the scopes stack. */ idl_global->scopes ().push (factory); + + delete $3; } init_parameter_list { @@ -6581,6 +6617,8 @@ porttype_decl // Push it on the scopes stack. idl_global->scopes ().push (p); + + delete $3; } '{' { @@ -6765,6 +6803,7 @@ at_least_one_actual_parameter 1); } + delete $1; $3->enqueue_head ($2); $<alval>$ = $3; } @@ -6780,6 +6819,7 @@ actual_parameters 1); } + delete $3; $1->enqueue_tail ($4); $<alval>$ = $1; } @@ -6912,6 +6952,8 @@ connector_header // Push it on the scopes stack. idl_global->scopes ().push (c); } + + delete $3; } ; |