Example #1
0
void
AST_Root::destroy (void)
{
  long i = 0;
  AST_Decl *d = 0;

  // Just destroy and delete everything but the CORBA
  // module, and the 'void' keyword, in case we are
  // processing multiple IDL files.
  // Final cleanup will be done in fini().
  long end = this->pd_decls_used;

  for (i = 2; i < end; ++i)
    {
      d = this->pd_decls[i];

      d->destroy ();
      delete d;
      d = 0;
      --this->pd_decls_used;
    }

  // Same goes for the references and the name
  // references, leave the first 2.

  // 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 = 2; i < this->pd_referenced_used; ++i)
    {
      this->pd_referenced[i] = 0;
    }

  this->pd_referenced_used = 2;

  for (i = 2; i < this->pd_name_referenced_used; ++i)
    {
      Identifier *id = this->pd_name_referenced[i];
      id->destroy ();
      delete id;
      id = 0;
    }

  this->pd_name_referenced_used = 2;
}
Example #2
0
void
be_visitor_valuetype::gen_obv_init_constructor_args (be_valuetype *node,
                                                     unsigned long &index)
{
  TAO_OutStream *os = this->ctx_->stream ();
  AST_Type *parent = node->inherits_concrete ();

  // Generate for inherited members first.
  if (parent != 0)
    {
      be_valuetype *be_parent =
        be_valuetype::narrow_from_decl (parent);
      this->gen_obv_init_constructor_args (be_parent, index);
    }

  be_visitor_context ctx (*this->ctx_);
  be_visitor_args_arglist visitor (&ctx);

  for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next())
    {
      // be_attribute inherits from be_field
      // so we have to also screen out attributes
      be_field *f = be_field::narrow_from_decl (si.item ());
      be_attribute *attr =
        be_attribute::narrow_from_decl (si.item ());

      if (f == 0 || attr != 0)
        {
          continue;
        }

      *os << (index++ != 0 ? "," : "") << be_nl;

      ACE_CString arg_name ("_tao_init_");
      arg_name += f->local_name ()->get_string ();
      Identifier id (arg_name.c_str ());
      UTL_ScopedName sn (&id, 0);
      be_type *ft = be_type::narrow_from_decl (f->field_type ());
      bool seen = ft->seen_in_operation ();

      // This sets ft->seen_in_operation (true), so we have to
      // restore the original value below.
      be_argument arg (AST_Argument::dir_IN,
                       ft,
                       &sn);
      ft->seen_in_operation (seen);

      if (visitor.visit_argument (&arg) == -1)
        {
          ACE_ERROR ((LM_ERROR,
                      ACE_TEXT ("be_visitor_valuetype::")
                      ACE_TEXT ("gen_obv_init_constructor_args - ")
                      ACE_TEXT ("codegen for argument failed\n")));
        }

      // 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 ();
    }
}