| 1 |
// RUN: %clang_cc1 %s -std=c++11 -emit-llvm -triple %itanium_abi_triple -o - -fblocks -fexceptions | FileCheck %s |
| 2 |
|
| 3 |
struct A { |
| 4 |
int x; |
| 5 |
A(const A &); |
| 6 |
A(); |
| 7 |
~A() noexcept(false); |
| 8 |
}; |
| 9 |
|
| 10 |
struct B { |
| 11 |
int x; |
| 12 |
B(const B &); |
| 13 |
B(); |
| 14 |
~B(); |
| 15 |
}; |
| 16 |
|
| 17 |
int testA() { |
| 18 |
__block A a0, a1; |
| 19 |
^{ a0.x = 1234; a1.x = 5678; }; |
| 20 |
return 0; |
| 21 |
} |
| 22 |
|
| 23 |
// CHECK-LABEL: define internal void @__Block_byref_object_copy_ |
| 24 |
// CHECK: call {{.*}} @_ZN1AC1ERKS_ |
| 25 |
// CHECK-LABEL: define internal void @__Block_byref_object_dispose_ |
| 26 |
// CHECK: call {{.*}} @_ZN1AD1Ev |
| 27 |
|
| 28 |
// CHECK-LABEL: define linkonce_odr hidden void @__copy_helper_block_e{{4|8}}_{{20|32}}rc{{24|40}}rc( |
| 29 |
// CHECK: call void @_Block_object_assign( |
| 30 |
// CHECK: invoke void @_Block_object_assign( |
| 31 |
// CHECK: call void @_Block_object_dispose({{.*}}) #[[NOUNWIND_ATTR:[0-9]+]] |
| 32 |
|
| 33 |
// CHECK-LABEL: define linkonce_odr hidden void @__destroy_helper_block_e{{4|8}}_{{20|32}}rd{{24|40}}rd( |
| 34 |
// CHECK: invoke void @_Block_object_dispose( |
| 35 |
// CHECK: call void @_Block_object_dispose( |
| 36 |
// CHECK: invoke void @_Block_object_dispose( |
| 37 |
|
| 38 |
int testB() { |
| 39 |
__block B b0, b1; |
| 40 |
^{ b0.x = 1234; b1.x = 5678; }; |
| 41 |
return 0; |
| 42 |
} |
| 43 |
|
| 44 |
// CHECK-LABEL: define internal void @__Block_byref_object_copy_ |
| 45 |
// CHECK: call {{.*}} @_ZN1BC1ERKS_ |
| 46 |
// CHECK-LABEL: define internal void @__Block_byref_object_dispose_ |
| 47 |
// CHECK: call {{.*}} @_ZN1BD1Ev |
| 48 |
|
| 49 |
// CHECK-NOT: define{{.*}}@__copy_helper_block |
| 50 |
// CHECK: define linkonce_odr hidden void @__destroy_helper_block_e{{4|8}}_{{20|32}}r{{24|40}}r( |
| 51 |
|
| 52 |
// CHECK: attributes #[[NOUNWIND_ATTR]] = {{{.*}}nounwind{{.*}}} |
| 53 |
namespace test1 { |
| 54 |
struct A { int x; A(); ~A(); }; |
| 55 |
|
| 56 |
void test() { |
| 57 |
return; |
| 58 |
__block A a; |
| 59 |
} |
| 60 |
} |