summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/temporaries.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2013-12-06 18:56:29 +0000
committerAnna Zaks <ganna@apple.com>2013-12-06 18:56:29 +0000
commitcf8d2165ffebd254927463af7d86f61d8bbd3fd2 (patch)
treecd59cde242b50c800597e0d404729d22141ed601 /clang/test/Analysis/temporaries.cpp
parentba0aea16e1902cf39d32e2617b88582519e31a28 (diff)
downloadbcm5719-llvm-cf8d2165ffebd254927463af7d86f61d8bbd3fd2.tar.gz
bcm5719-llvm-cf8d2165ffebd254927463af7d86f61d8bbd3fd2.zip
Revert "[analyzer] Refactor conditional expression evaluating code"
This reverts commit r189090. The original patch introduced regressions (see the added live-variables.* tests). The patch depends on the correctness of live variable analyses, which are not computed correctly. I've opened PR18159 to track the proper resolution to this problem. The patch was a stepping block to r189746. This is why part of the patch reverts temporary destructor tests that started crashing. The temporary destructors feature is disabled by default. llvm-svn: 196593
Diffstat (limited to 'clang/test/Analysis/temporaries.cpp')
-rw-r--r--clang/test/Analysis/temporaries.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/clang/test/Analysis/temporaries.cpp b/clang/test/Analysis/temporaries.cpp
index d5237e597cf..6b49fcbddd4 100644
--- a/clang/test/Analysis/temporaries.cpp
+++ b/clang/test/Analysis/temporaries.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w -std=c++03 %s
// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w -std=c++11 %s
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify -w -analyzer-config cfg-temporary-dtors=true %s -DTEMPORARY_DTORS
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -DTEMPORARY_DTORS -verify -w -analyzer-config cfg-temporary-dtors=true %s
extern bool clang_analyzer_eval(bool);
@@ -111,17 +111,20 @@ namespace compound_literals {
}
namespace destructors {
- void testPR16664Crash() {
+ void testPR16664andPR18159Crash() {
struct Dtor {
~Dtor();
};
extern bool coin();
extern bool check(const Dtor &);
- // Don't crash here.
+#ifndef TEMPORARY_DTORS
+ // FIXME: Don't crash here when tmp dtros are enabled.
+ // PR16664 and PR18159
if (coin() && (coin() || coin() || check(Dtor()))) {
Dtor();
}
+#endif
}
#ifdef TEMPORARY_DTORS
@@ -147,9 +150,6 @@ namespace destructors {
extern bool check(const NoReturnDtor &);
void testConsistencyIf(int i) {
- if (i == 5 && (i == 4 || i == 5 || check(NoReturnDtor())))
- clang_analyzer_eval(true); // expected-warning{{TRUE}}
-
if (i != 5)
return;
if (i == 5 && (i == 4 || check(NoReturnDtor()) || i == 5)) {
@@ -170,11 +170,18 @@ namespace destructors {
clang_analyzer_eval(true); // no warning, unreachable code
}
+
+/*
+ // PR16664 and PR18159
+ FIXME: Don't crash here.
void testConsistencyNested(int i) {
extern bool compute(bool);
-
+
+ if (i == 5 && (i == 4 || i == 5 || check(NoReturnDtor())))
+ clang_analyzer_eval(true); // expected TRUE
+
if (i == 5 && (i == 4 || i == 5 || check(NoReturnDtor())))
- clang_analyzer_eval(true); // expected-warning{{TRUE}}
+ clang_analyzer_eval(true); // expected TRUE
if (i != 5)
return;
@@ -183,7 +190,7 @@ namespace destructors {
(i == 4 || compute(true) ||
compute(i == 5 && (i == 4 || check(NoReturnDtor()))))) ||
i != 4) {
- clang_analyzer_eval(true); // expected-warning{{TRUE}}
+ clang_analyzer_eval(true); // expected TRUE
}
if (compute(i == 5 &&
@@ -192,7 +199,8 @@ namespace destructors {
i != 4) {
clang_analyzer_eval(true); // no warning, unreachable code
}
- }
+ }*/
+
#endif // TEMPORARY_DTORS
}
OpenPOWER on IntegriCloud