blob: 2d9243e145b18420be951852d886501fd7a4de32 [file] [log] [blame]
Hans Wennborg442e4f72013-12-13 22:43:52 +00001// RUN: %clang_cc1 %s -emit-llvm -cxx-abi itanium -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_
Fariborz Jahanian3086ddf2010-12-02 17:58:10 +000023// CHECK: call void @_Block_object_assign
Stephen Lin43622612013-08-15 06:47:53 +000024// CHECK-LABEL: define internal void @__destroy_helper_block_
Fariborz Jahanian3086ddf2010-12-02 17:58:10 +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}