[PATCH] D42082: Add DWARF for discriminated unions
Paul Robinson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 14:50:43 PST 2018
probinson added a comment.
As I poke around the web looking for how a Rust enum-with-value works, it appears that Rust has what in Pascal would be a tagged variant record with no invariant part and no default variant. It's the web, of course, so it might be lying to me, but that's what I see, and it's about 90% of what you need for Pascal. The DWARF spec does not provide an example of a variant record, but I would expect to see something along these lines in the final DWARF:
DW_TAG_struct_type // type entry for the enum-with-fields
DW_TAG_variant_part // because DWARF says variant_part is owned by the struct_type
DW_AT_discr // reference to the discriminator field
DW_TAG_member // this is the discriminator field, where the enum value is stored
DW_TAG_variant // wrapper for the first variant
DW_AT_discr_value // first discriminant value
DW_TAG_member ... // member(s) for the first variant
DW_TAG_variant // wrapper for the second variant
DW_AT_discr_value // second discriminant value
DW_TAG_member ... // member(s) for the second variant
// etc
Is that what you are trying to produce?
Repository:
rL LLVM
https://reviews.llvm.org/D42082
More information about the llvm-commits
mailing list