This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] C++/DWARF : Add 'using' support - take 2



On Jan 13, 2004, at 2:32 PM, Jason Merrill wrote:


I'd prefer to do without all the changes to make gen_subprogram_die return
a value. I don't see a good reason to break the convention of "generate,
then look up" for just this one variety of DIE.

We do not equate abstract dies with decl number

Huh?

Oops, I gave wrong reason. We do not equate declaration dies unless it is for abstract functions. In force_decl_die() we do...

          if (DECL_INITIAL (decl) == NULL_TREE)
            /* Force die to represent this function declaration.  */
            decl_die = gen_subprogram_die (decl, context_die);

and in gen_subprogram_die() we have

  if (declaration)
    {
      if (!old_die || !get_AT (old_die, DW_AT_inline))
        {
          add_AT_flag (subr_die, DW_AT_declaration, 1);

/* The first time we see a member function, it is in the context of
the class to which it belongs. We make sure of this by emitting
the class first. The next time is the definition, which is
handled above. The two may come from the same source text. */
if (DECL_CONTEXT (decl) || DECL_ABSTRACT (decl))
equate_decl_number_to_die (decl, subr_die);
}
}


You should handle this in the "else if (old_die)" block below, which also
deals with reusing a die.

It handles reusing decl die as definition die. We need to complete this
die which is the else section after "else if (old_die)".

What do you mean by "complete"? The die created by force_decl_die should
be a declaration die, so reusing it as a definition die should be what we
want.

We also force abstract function dies.


I don't see how checking die_definition makes any sense here.  What
situation is this code trying to handle?

If variable for forced out earlier than later on add_AT_specification()
aborts because die_definition is non-zero.

Why is it non-zero?

Because die for variable is already forced out. I just need a check to skip it next time.

! force_decl_die (tree decl)
! {
...
! 	  else if (DECL_INLINE (decl))
! 	    /* Force die to represent this function as abstract
! 	       function for our reference.  */
! 	      dwarf2out_abstract_function (decl);

I realize that I suggested this in my earlier review, but I think we
shouldn't handle inline functions differently here. If all we care about
is having a DIE to refer to, we don't need to emit the whole abstract
function.

so instead what do you suggest here?

I think we want to force a declaration die in all cases, regardless of
whether or not the function has been defined. I'm reluctant to change the
order in which definition dies are emitted.

I think, I tried that but did not work out well for inlines hence you suggested to emit die to represent abstract function. Anyway, I'll give it another shot.

Thanks,
--
Devang


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]