xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/block-byref-cxx-objc.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -o - -fblocks | FileCheck %s
2*f4a2713aSLionel Sambuc // rdar://8594790
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc struct A {
5*f4a2713aSLionel Sambuc 	int x;
6*f4a2713aSLionel Sambuc 	A(const A &);
7*f4a2713aSLionel Sambuc 	A();
8*f4a2713aSLionel Sambuc 	~A();
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc int main()
12*f4a2713aSLionel Sambuc {
13*f4a2713aSLionel Sambuc 	__block A BYREF_VAR;
14*f4a2713aSLionel Sambuc         ^{ BYREF_VAR.x = 1234; };
15*f4a2713aSLionel Sambuc 	return 0;
16*f4a2713aSLionel Sambuc }
17*f4a2713aSLionel Sambuc 
18*f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @__Block_byref_object_copy_
19*f4a2713aSLionel Sambuc // CHECK: call {{.*}} @_ZN1AC1ERKS_
20*f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @__Block_byref_object_dispose_
21*f4a2713aSLionel Sambuc // CHECK: call {{.*}} @_ZN1AD1Ev
22*f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @__copy_helper_block_
23*f4a2713aSLionel Sambuc // CHECK: call void @_Block_object_assign
24*f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @__destroy_helper_block_
25*f4a2713aSLionel Sambuc // CHECK: call void @_Block_object_dispose
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc // rdar://problem/11135650
28*f4a2713aSLionel Sambuc namespace test1 {
29*f4a2713aSLionel Sambuc   struct A { int x; A(); ~A(); };
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc   void test() {
32*f4a2713aSLionel Sambuc     return;
33*f4a2713aSLionel Sambuc     __block A a;
34*f4a2713aSLionel Sambuc   }
35*f4a2713aSLionel Sambuc }
36