[clang] [analyzer][NFC] Rework SVal kind representation (PR #71039)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 3 04:53:59 PDT 2023


steakhal wrote:

> But I have to point out that this patch doesn't address the fact that `const void* Data` is not friendly to debuggers, especially with type information encoded in another member. So even with this patch applied, someone would still have to write (and maintain) a custom formatter on debugger side to display `Data` correctly.
> 
> If you refactor `const void* Data` to be a `llvm::PointerUnion`, then it will be picked up automatically (`PointerUnion` is a popular type, so I've already written a formatter for it.) Together with removing `BaseBits` from `Kind` and making the latter non-packed, `SVal` will have a debugger-friendly layout.

What other ways are to make a `const void *` debugger-friendly - other than `llvm::PointerUnion`?
I've considered using plain-old unions, but I found that approach pretty ugly, and I'm not even sure if it would help debugging experience.

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


More information about the cfe-commits mailing list