DWARF Standard


180517.2 Tom Tromey Tagless variant parts Enhancement Rejected Markus Metzger

Section 5.7.10, pg 123

I'm working on improving the DWARF output of the Rust compiler.

In Rust, an enum is a discriminated union.  The compiler supplies 
the discriminant.  It's possible in Rust to have a unvariant enum, 
in which case the compiler omits the discriminant field entirely.

In the Rust compiler (and in LLVM and in gdb) we've chosen to 
represent this as a DW_TAG_variant_part that has a single child 
(the enum payload), but which does not have a DW_AT_discr member.

I suggest adding text to 5.7.10 allowing this use, for example:

If the variant part does not have a discriminant, then the variant 
part should have a single DW_TAG_variant child.

2022-01-10: Rejected
  Proposed change conflicts with usage in Pascal and Ada. 
  Standard allows proposed use case.  

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2007-2022 by DWARF Standards Committee.