[Lldb-commits] [lldb] Use `llvm::APInt` for `VariantMember` Discriminants (PR #188487)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 10 05:02:10 PDT 2026
================
@@ -2596,8 +2597,31 @@ bool VariantMember::IsDefault() const { return !discr_value; }
VariantMember::VariantMember(DWARFDIE &die, lldb::ModuleSP module_sp) {
assert(die.Tag() == llvm::dwarf::DW_TAG_variant);
- this->discr_value =
- die.GetAttributeValueAsOptionalUnsigned(DW_AT_discr_value);
+
+ DWARFFormValue discr_form;
+ die.GetDIE()->GetAttributeValue(die.GetCU(), DW_AT_discr_value, discr_form);
+
+ // rust can output 128-bit discrs (e.g. NonNull<u128>) as `DW_FORM_block1`.
+ // there is a `data16`, but the DIE function treats it as a block anyway.
+ // Handling is included for it just in case rust's output changes to the
+ // `data16` version
----------------
JDevlieghere wrote:
```suggestion
// Rust can output 128-bit discrs (e.g. NonNull<u128>) as `DW_FORM_block1`.
// There is a `data16`, but the DIE function treats it as a block anyway.
// Handling is included for it just in case rust's output changes to the
// `data16` version.
```
https://github.com/llvm/llvm-project/pull/188487
More information about the lldb-commits
mailing list