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

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 09:11:29 PST 2024


Endilll wrote:

> It shouldn't be necessary to analyze uint64_t Storage directly through a debugger. It's handled via the Bitfield getters and setters. Is that not sufficient for debugging purposes?

Unfortunately, it's not. Not every debugger can run getters while displaying the value (e.g. https://github.com/llvm/llvm-project/blob/main/clang/utils/ClangVisualizers/clang.natvis), ones that can (e.g. LLDB) do that in a matter of seconds, which is way beyond acceptable performance to keep debugger responsive.

> My sinister reason for wanting to do this is that many of the const_cast<IdentifierInfo>(...) constructs are there because some of these fields are updated. I'd like to get rid of those by making the storage mutable (pardon my French).

I don't find removing couple of `const_cast`s be worth the regression of debugging experience on something as important as `IdentifierInfo`. Moreover, replacing them with `mutable` to me sounds like replacing explicit workaround with implicit one, without addressing the root cause.

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


More information about the cfe-commits mailing list