summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/nrvo.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-15 16:39:56 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-15 16:39:56 +0000
commit170125648cd344b49bbf98f63757d263f5f95646 (patch)
treed39919034c4a2cf431d19a0971f27bab389b9bd5 /clang/test/CodeGenCXX/nrvo.cpp
parent8b07ec253d4042f824dccec711e17fb6d92bed5e (diff)
downloadbcm5719-llvm-170125648cd344b49bbf98f63757d263f5f95646.tar.gz
bcm5719-llvm-170125648cd344b49bbf98f63757d263f5f95646.zip
When applying the named return value optimization, we still need to
destroy the variable along the exceptional edge; it's only during normal execution that we avoid destroying this variable. llvm-svn: 103872
Diffstat (limited to 'clang/test/CodeGenCXX/nrvo.cpp')
-rw-r--r--clang/test/CodeGenCXX/nrvo.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/nrvo.cpp b/clang/test/CodeGenCXX/nrvo.cpp
index 7b4f20398d8..92b41036027 100644
--- a/clang/test/CodeGenCXX/nrvo.cpp
+++ b/clang/test/CodeGenCXX/nrvo.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -fexceptions -o - %s | FileCheck --check-prefix=CHECK-EH %s
// Test code generation for the named return value optimization.
class X {
@@ -9,11 +10,15 @@ public:
};
// CHECK: define void @_Z5test0v
+// CHECK-EH: define void @_Z5test0v
X test0() {
X x;
// CHECK-NOT: call void @_ZN1XD1Ev
// CHECK: ret void
+ // CHECK-EH: ret void
return x;
+ // CHECK-EH: ehcleanup:
+ // CHECK-EH: invoke void @_ZN1XD1Ev
}
// CHECK: define void @_Z5test1b(
@@ -25,9 +30,12 @@ X test1(bool B) {
if (B)
return (x);
return x;
+ // CHECK-EH: ehcleanup:
+ // CHECK-EH: invoke void @_ZN1XD1Ev
}
// CHECK: define void @_Z5test2b
+// CHECK-EH: define void @_Z5test2b
X test2(bool B) {
// No NRVO
// CHECK: call void @_ZN1XC1Ev
@@ -35,13 +43,18 @@ X test2(bool B) {
// CHECK: call void @_ZN1XC1Ev
X y;
// CHECK: call void @_ZN1XC1ERKS_
+ // CHECK-EH: invoke void @_ZN1XC1ERKS_
if (B)
return y;
// CHECK: call void @_ZN1XC1ERKS_
+ // CHECK-EH: invoke void @_ZN1XC1ERKS_
return x;
// CHECK: call void @_ZN1XD1Ev
// CHECK: call void @_ZN1XD1Ev
// CHECK: ret void
+ // CHECK-EH: ehcleanup:
+ // CHECK-EH: invoke void @_ZN1XD1Ev
+ // CHECK-EH: invoke void @_ZN1XD1Ev
}
X test3(bool B) {
OpenPOWER on IntegriCloud