[clang] [clang] Add clang::debug_info_type attribute for bitfields (PR #69104)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 12:27:32 PDT 2023


philnik777 wrote:

> One thing I REALLY hate about our pattern of using bitfields for enums, is that it becomes pretty trivial to add an entry to an enum and forget to increase the size of the bitfield. I think such a attribute could cause a diagnostic of `bitfield says it holds an ENUM type, but can't store all the values`, which would be INCREDIBLY valuable (not that I'm pushing that this patch IMPLEMENT that, but more that I'm saying such a name COULD do that, and probably should as well).
> 
> So in conclusion, I don't mind the name, but also prefer something more general.

Couldn't we add a warning for that in general? Seems like a pretty useful one to me.

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


More information about the cfe-commits mailing list