[clang] [NFC][IdentifierInfo] Use llvm::Bitfield for the bitfield (PR #79366)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 24 13:31:12 PST 2024


Endilll wrote:

I find `llvm::Bitfield` API with all its explicit setters with explicit storage parameter clunky compared to language bit-fields. But that's minor. My major issue with this patch is that `uint64_t Storage;` is as opaque for debuggers as it gets. It would take so much work to correctly interpret its value when you work backwards from the field (extracting all those member types), that `LLVM_PREFERRED_TYPE(IdentifierInfoBits) uint64_t Storage`, where `IdentifierInfoBits` is a struct with current bit-fields, doesn't sound as bad to me as it should.

I see an improvement with consistent asserting that value we set fits the bit-field, but I'm not sold that this is the best way to go. For starters, we can again have an `IdentifierInfoBits` type which adds said assertions to every setter, but actual storage is still a bit-field with `LLVM_PREFERRED_TYPE` on it. Admittedly, this is more work and more boilerplate, but it provides the same improvement on assertions without compromising debugging experience.

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


More information about the cfe-commits mailing list