summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/temporaries.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2019-08-28 18:44:42 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2019-08-28 18:44:42 +0000
commitead98ea3eb4e207be7ca003b612b68b7dfbb8f7e (patch)
tree5c646f192bc8620036c4a7b20f27d038597aab6a /clang/test/Analysis/temporaries.cpp
parent630f7daf80fe36d3aa4a9ebe60e7abefae514bba (diff)
downloadbcm5719-llvm-ead98ea3eb4e207be7ca003b612b68b7dfbb8f7e.tar.gz
bcm5719-llvm-ead98ea3eb4e207be7ca003b612b68b7dfbb8f7e.zip
[CFG] Make representation of destructor calls more accurate.
Respect C++17 copy elision; previously it would generate destructor calls for elided temporaries, including in initialization and return statements. Don't generate duplicate destructor calls for statement expressions. Fix destructors in initialization lists and comma operators. Improve printing of implicit destructors. Patch by Nicholas Allegra! Differential Revision: https://reviews.llvm.org/D66404 llvm-svn: 370247
Diffstat (limited to 'clang/test/Analysis/temporaries.cpp')
-rw-r--r--clang/test/Analysis/temporaries.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/clang/test/Analysis/temporaries.cpp b/clang/test/Analysis/temporaries.cpp
index 6191abfb4d2..012cef52f14 100644
--- a/clang/test/Analysis/temporaries.cpp
+++ b/clang/test/Analysis/temporaries.cpp
@@ -830,12 +830,7 @@ void test_ternary_temporary_with_copy(int coin) {
// On each branch the variable is constructed directly.
if (coin) {
clang_analyzer_eval(x == 1); // expected-warning{{TRUE}}
-#if __cplusplus < 201703L
clang_analyzer_eval(y == 1); // expected-warning{{TRUE}}
-#else
- // FIXME: Destructor called twice in C++17?
- clang_analyzer_eval(y == 2); // expected-warning{{TRUE}}
-#endif
clang_analyzer_eval(z == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(w == 0); // expected-warning{{TRUE}}
@@ -843,12 +838,7 @@ void test_ternary_temporary_with_copy(int coin) {
clang_analyzer_eval(x == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(y == 0); // expected-warning{{TRUE}}
clang_analyzer_eval(z == 1); // expected-warning{{TRUE}}
-#if __cplusplus < 201703L
clang_analyzer_eval(w == 1); // expected-warning{{TRUE}}
-#else
- // FIXME: Destructor called twice in C++17?
- clang_analyzer_eval(w == 2); // expected-warning{{TRUE}}
-#endif
}
}
} // namespace test_match_constructors_and_destructors
@@ -1055,16 +1045,11 @@ void foo(void (*bar4)(S)) {
#endif
bar2(S(2));
- // FIXME: Why are we losing information in C++17?
clang_analyzer_eval(glob == 2);
#ifdef TEMPORARY_DTORS
-#if __cplusplus < 201703L
- // expected-warning@-3{{TRUE}}
-#else
- // expected-warning@-5{{UNKNOWN}}
-#endif
+ // expected-warning@-2{{TRUE}}
#else
- // expected-warning@-8{{UNKNOWN}}
+ // expected-warning@-4{{UNKNOWN}}
#endif
C *c = new D();
OpenPOWER on IntegriCloud