[PATCH] D141414: [clang] add warning on shifting boolean type

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 13 05:06:11 PDT 2023


aaron.ballman added a comment.

In D141414#4494064 <https://reviews.llvm.org/D141414#4494064>, @arsenm wrote:

> ping?

Thank you for pinging this! I took a quick pass over the changes and they're moving in the right direction, but there are some new test failures that need addressing and some unfinished comments from the previous review.



================
Comment at: clang/lib/Sema/SemaExpr.cpp:11955-11956
+    Diag(Loc, diag::warn_shift_on_bool_type) << (Opc == BO_Shr)
+      << "'bool && (shift_count | desired_type_width - 1)'"
+      << "'bool & !shift_count'";
 
----------------
We try not to pass constant strings into diagnostics because that makes it harder for us to localize diagnostics in the future. Instead, these strings should be in the diagnostic wording itself (with a `%select` directive).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141414/new/

https://reviews.llvm.org/D141414



More information about the cfe-commits mailing list