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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 20 10:55:20 PDT 2023


AaronBallman wrote:

> > I wonder if we should treat one-bit bit-fields as if they were bool automatically (e.g., create this attribute implicitly in that case). How often do we expect to see one-bit bit-fields that are arithmetic? I'm sure it happens (to multiply against -1, 0, or 1 depending on the sign of the bit-field, for example), but I expect it to be quite rare compared to bool-like use.
> 
> I'd be tentative to do that initially, I think I'd prefer that be a future 'enhancement' after we evaluate the fall-out of this. The rest of this patch has some significant promise, and I'd like to not hold it up trying to evaluate that.

I'm retracting my suggestion there. I think this should be a default behavior of the debugger, but it shouldn't be forced on users by the compiler. Users who don't expect that behavior then won't have to fight against implicit compiler behavior.

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


More information about the cfe-commits mailing list