[PATCH] D130510: Missing tautological compare warnings due to unary operators

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 27 11:02:17 PDT 2022


aaron.ballman added a comment.

Thank you for this, I think this is good incremental progress and is almost ready to go. Just a few small nits, but also, can you also add a release note for the fix (be sure to mention which issue is being closed too).

Note, the precommit CI failures are unrelated to the changes in this patch.



================
Comment at: clang/test/Sema/warn-bitwise-compare.c:41
+
+  int y = ((8 & x)  == 3) ? 1 : 2;  // expected-warning {{bitwise comparison always evaluates to false}}
+      y = ((-8 & x) == 3) ? 1 : 2;  // expected-warning {{bitwise comparison always evaluates to false}}
----------------



================
Comment at: clang/test/Sema/warn-bitwise-compare.c:68
+
+  if ((x^0) == 0){}
+
----------------



================
Comment at: clang/test/SemaCXX/warn-unreachable.cpp:402-408
+  if (x == -1)   // expected-note {{silence}}
+    calledFun(); // expected-warning {{will never be executed}}
 
-  if (x != -1)
+  if (x != -1)   // expected-note {{silence}}
     calledFun();
   else
+    calledFun(); // expected-warning {{will never be executed}}
----------------
We should move these up above the TODO comment on line 399, since these are now getting the expected warnings.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130510



More information about the cfe-commits mailing list