summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/blocks.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-08-17 21:34:14 +0000
committerJohn McCall <rjmccall@apple.com>2011-08-17 21:34:14 +0000
commitd963c37eb912342c8325048749e449861cf0a6e3 (patch)
tree8c3ba183cec56377add9f4102b6c56688aad9fc3 /test/CodeGenCXX/blocks.cpp
parent6704429557544a890cf6c0859b13b1dc63572f70 (diff)
Gather cleanups correctly in block return statements.
Thanks to Ted for finding this with magic tools. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/blocks.cpp')
-rw-r--r--test/CodeGenCXX/blocks.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CodeGenCXX/blocks.cpp b/test/CodeGenCXX/blocks.cpp
index 0e310bdbbc..a35b5a370e 100644
--- a/test/CodeGenCXX/blocks.cpp
+++ b/test/CodeGenCXX/blocks.cpp
@@ -104,3 +104,29 @@ namespace test3 {
consume(^{ (void) b; });
}
}
+
+// rdar://problem/9971485
+namespace test4 {
+ struct A {
+ A();
+ ~A();
+ };
+
+ void foo(A a);
+
+ void test() {
+ extern void consume(void(^)());
+ consume(^{ return foo(A()); });
+ }
+ // CHECK: define void @_ZN5test44testEv()
+ // CHECK: define internal void @__test_block_invoke
+ // CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align 1
+ // CHECK-NEXT: alloca i32
+ // CHECK-NEXT: bitcast i8*
+ // CHECK-NEXT: call void @_ZN5test41AC1Ev([[A]]* [[TMP]])
+ // CHECK-NEXT: call void @_ZN5test43fooENS_1AE([[A]]* [[TMP]])
+ // CHECK-NEXT: store i32 1,
+ // CHECK-NEXT: call void @_ZN5test41AD1Ev([[A]]* [[TMP]])
+ // CHECK-NEXT: ret void
+}
+