[PATCH] D132851: Further update -Wbitfield-constant-conversion for 1-bit bitfield
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 29 08:34:05 PDT 2022
erichkeane accepted this revision.
erichkeane added a comment.
This revision is now accepted and ready to land.
2 nits, otherwise LGTM.
================
Comment at: clang/lib/Sema/SemaChecking.cpp:13080
- S.Diag(InitLoc, diag::warn_impcast_bitfield_precision_constant)
- << PrettyValue << PrettyTrunc << OriginalInit->getType()
- << Init->getSourceRange();
+ bool IsOneBit = FieldWidth == 1 && Value == 1;
+ S.Diag(InitLoc, IsOneBit
----------------
Might consider hoisting this line above the macro-checking, and just use it in both cases. Also, perhaps a more descriptive name? `IsInvalidSignedOneBitAssignment` ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132851/new/
https://reviews.llvm.org/D132851
More information about the cfe-commits
mailing list