summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/temporaries.cpp
diff options
context:
space:
mode:
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