[PATCH] D42082: Add DWARF for discriminated unions

Robinson, Paul via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 14:43:56 PST 2018


Well, that would be combining existing DWARF features in a novel way, which is what the "permissive" aspect of DWARF is all about.  I'd still worry that a debugger would choke on it (although dwarfdump likely would be unfazed) but it seems closer to the original Rust construct than trying to turn it into a "normal" variant record.  And then all Rust enums would be using the same tag, which might be a good thing.
--paulr

From: David Blaikie [mailto:dblaikie at gmail.com]
Sent: Thursday, January 18, 2018 2:29 PM
To: reviews+D42082+public+34a7df3826d543fe at reviews.llvm.org
Cc: ttromey at mozilla.com; echristo at gmail.com; Robinson, Paul; aprantl at apple.com; jdevlieghere at apple.com; llvm-commits at lists.llvm.org
Subject: Re: [PATCH] D42082: Add DWARF for discriminated unions

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.

On Thu, Jan 18, 2018 at 2:26 PM Tom Tromey via Phabricator <reviews at reviews.llvm.org<mailto:reviews at reviews.llvm.org>> wrote:
tromey added a comment.

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.

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?


Repository:
  rL LLVM

https://reviews.llvm.org/D42082


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180118/0f832c22/attachment.html>


More information about the llvm-commits mailing list