[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 11:39:34 PDT 2023


Endilll wrote:

I'm ignoring signed/unsigned mismatch as @erichkeane and @AaronBallman suggested. The only outstanding aspect is the following diagnostic I added today and haven't received feedback on:
```cpp
  [[clang::preferred_type(bool)]] unsigned b4 : 1;
  [[clang::preferred_type(bool)]] unsigned b5 : 2;
  // expected-warning at -1 {{bit-field that holds a boolean value should have width of 1 instead of 2}}
```

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


More information about the cfe-commits mailing list