r179879 - Emit the underlying type in the debug info for all kinds of fixed enums
David Blaikie
dblaikie at gmail.com
Sun May 11 10:38:42 PDT 2014
On Sun, May 11, 2014 at 10:30 AM, Stephan Tolksdorf <st at quanttec.com> wrote:
>
> David Blaikie wrote:
>>
>> Just to come back to this. It's not just a question of bloat, it's
>> just incorrect to put DW_AT_enum_class on an enum that's not an enum
>> class... classes with fixed underlying type aren't necessarily enum
>> classes:
>>
>> enum x : int { }; // fixed underlying type, but not an enum class,
>> should not have DW_AT_enum_class
>>
>> enum class x { }; // no fixed underlying type, but is an enum class
>
>
> [dcl.enum]p5 of the C++ standard states
> "The underlying type can be explicitly specified using enum-base; if not
> explicitly specified, the underlying type of a scoped enumeration type is
> int. In these cases, the underlying type is said to be
> fixed."
>
> I read this as saying that the underlying type of a scoped enumeration is
> always "fixed".
Fair point - thanks for the wording. I hadn't got around to checking
on that & so I was using the terminology a little too loosely.
Still a valid issue here: not all enums with fixed underlying type are
scoped enums. So if we want to emit the underlying type for all fixed
enums then we need another way, in LLVM, to decide whether to attach
DW_AT_enum_class. Probably a flag.
(that said, GCC doesn't produce the underlying type at all for any
enums - though it's not expensive, it'd be nice to understand what
value we're adding here)
- David
More information about the cfe-commits
mailing list