[clang] [lldb] [lldb] Analyze enum promotion type during parsing (PR #115005)

Michael Buch via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 5 07:33:25 PST 2024


Michael137 wrote:

I haven't done an in-depth review of the patch yet but my first instinct here is that this looks like a lot of work for LLDB which the compiler has already done, so we ideally don't want to repeat. Where is this actually an issue from a user perspective? In the example you gave one could just cast to the appropriate enum type and get the bit-mask style presentation:
```
(lldb) expr (UnscopedEnum) (-enum_one)
(UnscopedEnum) $0 = One | 0xfffffffe
```
Not that this shouldn't be fixed, just weighing of the amount of complexity added here versus the benefit.

Also, is this promotion-type something that can be encoded in DWARF? GCC generates the same DWARF as Clang here. What happens if we make the type of the `DW_TAG_variable`s be `UnscopedEnum` instead of `int`? I guess that wouldn't help with
```
(lldb) expr UnscopedEnum::One + 1
```

https://github.com/llvm/llvm-project/pull/115005


More information about the cfe-commits mailing list