]> granicus.if.org Git - clang/commit
Extend -Wtautological-constant-out-of-range-compare to handle boolean values
authorRichard Trieu <rtrieu@google.com>
Fri, 4 Apr 2014 04:13:47 +0000 (04:13 +0000)
committerRichard Trieu <rtrieu@google.com>
Fri, 4 Apr 2014 04:13:47 +0000 (04:13 +0000)
commit95aafb490aa84ff87c1436ba00d95c1561741f04
tree57759f1cd256b1cb34bd28a25fa91f8a3f58a5f5
parent6acf9ee0e5e7a18998d81281d81de082a6b4b12a
Extend -Wtautological-constant-out-of-range-compare to handle boolean values
better.  This warning will now trigger on the following conditionals:

bool b;
int i;

if (b > 1) {}  // always false
if (0 <= (i > 5)) {} // always true
if (-1 > b) {} // always false

Patch by Per Viberg.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205608 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
lib/AST/Expr.cpp
lib/Sema/SemaChecking.cpp
test/Sema/bool-compare.c [new file with mode: 0644]
test/SemaCXX/bool-compare.cpp [new file with mode: 0644]