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