[PATCH] D42082: Add DWARF for discriminated unions
Paul Robinson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 13:07:40 PST 2018
probinson added a comment.
In https://reviews.llvm.org/D42082#979081, @tromey wrote:
> I think this approach actually makes more sense, because surely the discriminant is something whose placement cannot vary.
But it doesn't. It's a child of TAG_variant_part, but not under any individual TAG_variant.
That said, I'm happy to support a proposal to move the discriminant's member description out from under TAG_variant_part. Especially given GCC's practice, which probably is the same for Pascal as it is for Ada. Semantically it doesn't make any real difference where that member goes.
> I'm thinking now `DW_TAG_Rust_enum` would be a better fit for what I need. This approach would let me handle univariant enums consistently as well.
I'd argue against a new tag, because it raises the barrier to debugger support for Rust. I can see wanting to emit all Rust enums consistently, whether they have variant data or not.
How about this: A Rust enum is implicitly a struct, which has one member in the "univariant" case, and a variant part if it does have additional data. I'll accept putting the member outside the TAG_variant_part; it's pedantically incorrect but there's a good case for doing it the other way.
Repository:
rL LLVM
https://reviews.llvm.org/D42082
More information about the llvm-commits
mailing list