]> granicus.if.org Git - clang/commit
Add a new subgroup to -Wtautological-compare, -Wtautological-overlap-compare,
authorRichard Trieu <rtrieu@google.com>
Sat, 5 Apr 2014 05:17:01 +0000 (05:17 +0000)
committerRichard Trieu <rtrieu@google.com>
Sat, 5 Apr 2014 05:17:01 +0000 (05:17 +0000)
commit8123887315f245efdafb56f151dd5048afb2f38c
tree55a0b979ffc54c09af96e49ef0b4cbde1b7d7a8b
parent8458c2cf4cc4674fb374fd764783d8892c095f35
Add a new subgroup to -Wtautological-compare, -Wtautological-overlap-compare,
which warns on compound conditionals that always evaluate to the same value.
For instance, (x > 5 && x < 3) will always be false since no value for x can
satisfy both conditions.

This patch also changes the CFG to use these tautological values for better
branch analysis.  The test for -Wunreachable-code shows how this change catches
additional dead code.

Patch by Anders Rönnholm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205665 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/CFG.h
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Analysis/CFG.cpp
lib/Sema/AnalysisBasedWarnings.cpp
test/Sema/warn-overlap.c [new file with mode: 0644]
test/SemaCXX/warn-unreachable.cpp