summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/identical-expressions.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2014-02-21 00:18:31 +0000
committerJordan Rose <jordan_rose@apple.com>2014-02-21 00:18:31 +0000
commit45d71a271554ff183629e7451ada8f440a20654c (patch)
treeda8164b52bcd959a9901cebdda39ddf54482fd4d /clang/test/Analysis/identical-expressions.cpp
parent75c47799434885787d26ecbafcb10db48674401d (diff)
downloadbcm5719-llvm-45d71a271554ff183629e7451ada8f440a20654c.tar.gz
bcm5719-llvm-45d71a271554ff183629e7451ada8f440a20654c.zip
[analyzer] Fix a bug in IdenticalExprChecker concerning while loops.
Somehow both Daniel and I missed the fact that while loops are only identical if they have identical bodies. Patch by Daniel Fahlgren! llvm-svn: 201829
Diffstat (limited to 'clang/test/Analysis/identical-expressions.cpp')
-rw-r--r--clang/test/Analysis/identical-expressions.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Analysis/identical-expressions.cpp b/clang/test/Analysis/identical-expressions.cpp
index 950cdd93ff4..e1f51af7c6f 100644
--- a/clang/test/Analysis/identical-expressions.cpp
+++ b/clang/test/Analysis/identical-expressions.cpp
@@ -1287,6 +1287,17 @@ void test_identical_branches_while(bool b) {
}
}
+void test_identical_branches_while_2(bool b) {
+ int i = 10;
+ if (b) { // no-warning
+ while (func())
+ i--;
+ } else {
+ while (func())
+ i++;
+ }
+}
+
void test_identical_branches_do_while(bool b) {
int i = 10;
if (b) { // expected-warning {{true and false branches are identical}}
OpenPOWER on IntegriCloud