summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/inlining/temp-dtors-path-notes.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-06-28 00:30:18 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-06-28 00:30:18 +0000
commit9a209ad1d88e73be3169a2373b4dbeb093ef0765 (patch)
treeef3a9dc430e52d0aa51b17f5db28f145a9515eb4 /clang/test/Analysis/inlining/temp-dtors-path-notes.cpp
parent3a670eacf6ea1f33d5a2e2c2d70298545f5233b7 (diff)
downloadbcm5719-llvm-9a209ad1d88e73be3169a2373b4dbeb093ef0765.tar.gz
bcm5719-llvm-9a209ad1d88e73be3169a2373b4dbeb093ef0765.zip
[analyzer] Add support for pre-C++17 copy elision.
r335795 adds copy elision information to CFG. This commit allows static analyzer to elide elidable copy constructors by constructing the objects that were previously subject to elidable copy directly in the target region of the copy. The chain of elided constructors may potentially be indefinitely long. This only happens when the object is being returned from a function which in turn is returned from another function, etc. NRVO is not supported yet. Differential Revision: https://reviews.llvm.org/D47671 llvm-svn: 335800
Diffstat (limited to 'clang/test/Analysis/inlining/temp-dtors-path-notes.cpp')
-rw-r--r--clang/test/Analysis/inlining/temp-dtors-path-notes.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/clang/test/Analysis/inlining/temp-dtors-path-notes.cpp b/clang/test/Analysis/inlining/temp-dtors-path-notes.cpp
index 6d1a42ff50c..40b26b5c91a 100644
--- a/clang/test/Analysis/inlining/temp-dtors-path-notes.cpp
+++ b/clang/test/Analysis/inlining/temp-dtors-path-notes.cpp
@@ -30,19 +30,14 @@ public:
};
void test(int coin) {
- // We'd divide by zero in the temporary destructor that goes after the
- // elidable copy-constructor from C(0) to the lifetime-extended temporary.
- // So in fact this example has nothing to do with lifetime extension.
- // Actually, it would probably be better to elide the constructor, and
- // put the note for the destructor call at the closing brace after nop.
+ // We'd divide by zero in the automatic destructor for variable 'c'.
const C &c = coin ? C(1) : C(0); // expected-note {{Assuming 'coin' is 0}}
// expected-note@-1{{'?' condition is false}}
// expected-note@-2{{Passing the value 0 via 1st parameter 'x'}}
// expected-note@-3{{Calling constructor for 'C'}}
// expected-note@-4{{Returning from constructor for 'C'}}
- // expected-note@-5{{Calling '~C'}}
c.nop();
-}
+} // expected-note{{Calling '~C'}}
} // end namespace test_lifetime_extended_temporary
namespace test_bug_after_dtor {
OpenPOWER on IntegriCloud