[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenCXX / block-byref-cxx-objc.cpp
blob6aca809c2c7210190fce58e04d050f0f3c0f5238
1 // RUN: %clang_cc1 %s -std=c++11 -emit-llvm -triple %itanium_abi_triple -o - -fblocks -fexceptions | FileCheck %s
2 // rdar://8594790
4 struct A {
5 int x;
6 A(const A &);
7 A();
8 ~A() noexcept(false);
9 };
11 struct B {
12 int x;
13 B(const B &);
14 B();
15 ~B();
18 int testA() {
19 __block A a0, a1;
20 ^{ a0.x = 1234; a1.x = 5678; };
21 return 0;
24 // CHECK-LABEL: define internal void @__Block_byref_object_copy_
25 // CHECK: call {{.*}} @_ZN1AC1ERKS_
26 // CHECK-LABEL: define internal void @__Block_byref_object_dispose_
27 // CHECK: call {{.*}} @_ZN1AD1Ev
29 // CHECK-LABEL: define linkonce_odr hidden void @__copy_helper_block_e{{4|8}}_{{20|32}}rc{{24|40}}rc(
30 // CHECK: call void @_Block_object_assign(
31 // CHECK: invoke void @_Block_object_assign(
32 // CHECK: call void @_Block_object_dispose({{.*}}) #[[NOUNWIND_ATTR:[0-9]+]]
34 // CHECK-LABEL: define linkonce_odr hidden void @__destroy_helper_block_e{{4|8}}_{{20|32}}rd{{24|40}}rd(
35 // CHECK: invoke void @_Block_object_dispose(
36 // CHECK: call void @_Block_object_dispose(
37 // CHECK: invoke void @_Block_object_dispose(
39 int testB() {
40 __block B b0, b1;
41 ^{ b0.x = 1234; b1.x = 5678; };
42 return 0;
45 // CHECK-LABEL: define internal void @__Block_byref_object_copy_
46 // CHECK: call {{.*}} @_ZN1BC1ERKS_
47 // CHECK-LABEL: define internal void @__Block_byref_object_dispose_
48 // CHECK: call {{.*}} @_ZN1BD1Ev
50 // CHECK-NOT: define{{.*}}@__copy_helper_block
51 // CHECK: define linkonce_odr hidden void @__destroy_helper_block_e{{4|8}}_{{20|32}}r{{24|40}}r(
53 // CHECK: attributes #[[NOUNWIND_ATTR]] = {{{.*}}nounwind{{.*}}}
55 // rdar://problem/11135650
56 namespace test1 {
57 struct A { int x; A(); ~A(); };
59 void test() {
60 return;
61 __block A a;