<div dir="ltr">Any difficulty with modelling this more generally - having a DW_TAG_enum_type (DICompositeType) with a member that's a DW_TAG_variant_part (probably another DICompositeType?) with the members - so it doesn't matter whether there's a discriminator on the enum_type, but there can be when needed.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jan 18, 2018 at 2:26 PM Tom Tromey via Phabricator <<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">tromey added a comment.<br>
<br>
Having the DIE shape conform to DWARF seems easy in this patch -- just a reordering in `DwarfUnit::constructDiscriminatorDIE`.  However I don't see how to nicely support univariant Rust enums; the variant part is triggered by having a discriminator, but these objects don't have enumerators.<br>
<br>
Maybe one idea would be to have `DIBuilder::createDiscriminatedUnionType` use `DW_TAG_variant_part` as its tag, then fix things up when emitting the DIEs in DwarfUnit.cpp.  Is that too gross?<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D42082" rel="noreferrer" target="_blank">https://reviews.llvm.org/D42082</a><br>
<br>
<br>
<br>
</blockquote></div>