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

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 08:33:46 PDT 2023


Endilll wrote:

> See how on the assignment to a bitfield we check to make sure the largest value of the enum will fit in the bitfield? I'm saying I want us to do this EARLIER, on declaration with this attribute.

I totally do. Thank you for pointing out to `-Wbitfield-enum-conversion`! But you should be able to see in my example above that we need a way to exclude an enumerator from this check (in my example it's `[[clang::non_storable]]` applied to `UncommonNameKindOffset`), otherwise we'll get false-positives.

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


More information about the cfe-commits mailing list