diff options
Diffstat (limited to 'test/CodeGenCXX/blocks.cpp')
-rw-r--r-- | test/CodeGenCXX/blocks.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/test/CodeGenCXX/blocks.cpp b/test/CodeGenCXX/blocks.cpp index 1500c0d698..81eef0e028 100644 --- a/test/CodeGenCXX/blocks.cpp +++ b/test/CodeGenCXX/blocks.cpp @@ -120,9 +120,11 @@ namespace test4 { } // CHECK: define void @_ZN5test44testEv() // CHECK: define internal void @___ZN5test44testEv_block_invoke - // CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align 1 - // CHECK-NEXT: bitcast i8* - // CHECK-NEXT: call void @_ZN5test41AC1Ev([[A]]* [[TMP]]) + // CHECK: [[TMP:%.*]] = alloca [[A:%.*]], align 1 + // CHECK-NEXT: store i8* [[BLOCKDESC:%.*]], i8** {{.*}}, align 8 + // CHECK-NEXT: load i8* + // CHECK-NEXT: bitcast i8* [[BLOCKDESC]] to <{ i8*, i32, i32, i8*, %struct.__block_descriptor* }>* + // CHECK: call void @_ZN5test41AC1Ev([[A]]* [[TMP]]) // CHECK-NEXT: call void @_ZN5test43fooENS_1AE([[A]]* [[TMP]]) // CHECK-NEXT: call void @_ZN5test41AD1Ev([[A]]* [[TMP]]) // CHECK-NEXT: ret void @@ -226,3 +228,28 @@ namespace test8 { template int X::foo<int>(); } + +// rdar://13459289 +namespace test9 { + struct B { + void *p; + B(); + B(const B&); + ~B(); + }; + + void use_block(void (^)()); + void use_block_2(void (^)(), const B &a); + + // Ensuring that creating a non-trivial capture copy expression + // doesn't end up stealing the block registration for the block we + // just parsed. That block must have captures or else it won't + // force registration. Must occur within a block for some reason. + void test() { + B x; + use_block(^{ + int y; + use_block_2(^{ (void)y; }, x); + }); + } +} |