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

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 2 03:55:04 PDT 2023


https://github.com/Endilll commented:

Converting packed `unsigned Kind` into non-packed `SValKind Kind` is definitely going to help debuggers to display the value correctly.

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.

That said, debugger-friendliness is probably not among top priorities, so I'm not going to block this patch, if this is the direction you and reviewers want to take.

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


More information about the cfe-commits mailing list