blob: ce1ebd615ef828627397bfc31777f82b31e5176a [file] [log] [blame]
Hans Wennborgc9bd88e2014-01-14 19:35:09 +00001// RUN: %clang_cc1 %s -emit-llvm -triple %itanium_abi_triple -o - -fblocks | FileCheck %s
Fariborz Jahanian3086ddf2010-12-02 17:58:10 +00002// rdar://8594790
3
4struct A {
5 int x;
6 A(const A &);
7 A();
8 ~A();
9};
10
11int main()
12{
13 __block A BYREF_VAR;
14 ^{ BYREF_VAR.x = 1234; };
15 return 0;
16}
17
Stephen Lin43622612013-08-15 06:47:53 +000018// CHECK-LABEL: define internal void @__Block_byref_object_copy_
Eli Friedmana526f272011-06-13 22:51:21 +000019// CHECK: call {{.*}} @_ZN1AC1ERKS_
Stephen Lin43622612013-08-15 06:47:53 +000020// CHECK-LABEL: define internal void @__Block_byref_object_dispose_
Eli Friedmana526f272011-06-13 22:51:21 +000021// CHECK: call {{.*}} @_ZN1AD1Ev
Stephen Lin43622612013-08-15 06:47:53 +000022// CHECK-LABEL: define internal void @__copy_helper_block_
David Blaikieea3e51d2015-06-29 17:29:50 +000023// CHECK: call {{.*}}void @_Block_object_assign
Stephen Lin43622612013-08-15 06:47:53 +000024// CHECK-LABEL: define internal void @__destroy_helper_block_
David Blaikieea3e51d2015-06-29 17:29:50 +000025// CHECK: call {{.*}}void @_Block_object_dispose
John McCall8c38d352012-04-13 18:44:05 +000026
27// rdar://problem/11135650
28namespace test1 {
29 struct A { int x; A(); ~A(); };
30
31 void test() {
32 return;
33 __block A a;
34 }
35}