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: [lto] PATCH: Add DIE readers for array and enum types


Sandra Loosemore wrote:
Mark Mitchell wrote:

!   if (name)
!     TYPE_NAME (type) = name;

That seems like the right thing, but it isn't. TYPE_NAME should actually be a TYPE_DECL whose DECL_NAME is the IDENTIFIER_NODE with the obvious name. See lto_read_base_type_DIE for the correct incantations here.

OK, I'm confused about this. I swiped this code from c-decl.c; see start_enum and pushtag. This is not exactly like the base_type case because the "name" here is just the enum tag, not a type name. I also looked at type_tag in dwarf2out.c to see where it gets the enum tag name from, and it seems that it can be either an IDENTIFIER_NODE or TYPE_DECL stored in the TYPE_NAME field. So... ???

Interesting. I see that gcc/tree.h does say that it can be either an IDENTIFIER_NODE or a TYPE_DECL. I know that in the C++ front-end it is always a TYPE_DECL. (And TYPE_IDENTIFIER is how you get the actual IDENTIFIER_NODE.)


So, I think your code is indeed OK as written. There's no point in creating TYPE_DECLs that we don't need.

Thanks,

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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