[PATCH] D66044: Extend -Wtautological-overlap-compare to accept negative values and integer conversions

Richard Trieu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 14:40:23 PDT 2019


rtrieu marked an inline comment as done.
rtrieu added inline comments.


================
Comment at: test/Sema/warn-unreachable.c:437
+  if (~ 1)
     return; // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]
   unaryOpNoFixit(); // expected-warning {{code will never be executed}}
----------------
jfb wrote:
> Why this change?
```
​  if (y == -1 && y != -1)  // condition from warn-unreachable.cpp
  if (- 1)  // condition here
```

The test case below in warn-unreachable.cpp all have silence notes on them.  For consistency, I wanted the new case involving (y == -1 && y != -1) to also have a silence case.  The change to the reachability analysis to do that would also generate a silence note for (- 1).  Since (- 1) now generates a silence, I picked a different unary operator that would not.


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

https://reviews.llvm.org/D66044





More information about the cfe-commits mailing list