[PATCH] Emit DW_AT_enum_class attribute for C++0x scoped enums

Jakub Jelinek jakub@redhat.com
Fri Apr 16 14:50:00 GMT 2010


On Fri, Apr 16, 2010 at 04:31:34PM +0200, Richard Guenther wrote:
> On Fri, Apr 16, 2010 at 4:26 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > Hi!
> >
> > DWARF4 adds a new DW_AT_enum_class attribute, a flag that should be set on
> > DW_TAG_enumeration_type for scoped enums, so that debuggers can restrict the
> > enumerators only to ENUM::enumx form.
> >
> > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> Ugh.  I hate to add a langhook for this as it won't ever work with LTO.
> Can you instead recycle some generic tree bit?

I don't believe this is common enough thing to waste a generic tree bit on
it right now.  There aren't enough bits for all kinds of things the
DWARF producer needs to know.  There are various possible approaches IMHO:
1) let the original FE through lang hooks dump that stuff into debug info
   and LTO FE then read that debug info and build its own DECL_LANG_SPECIFIC
   and TYPE_LANG_SPECIFIC to be able to answer the lang hooks
2) let the LTO streamer call the langhooks and stream the info in LTO
   format to be streamed back into LTO's TYPE_LANG_SPECIFIC/DECL_LANG_SPECIFIC
but IMHO it is better to make the bits all appear together just for LTO,
otherwise we needlessly increase memory consumption for stuff that in pure
C or pure C++ or pure Fortran won't ever appear together.

	Jakub



More information about the Gcc-patches mailing list