xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/block-in-ctor-dtor.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc typedef void (^dispatch_block_t)(void);
4f4a2713aSLionel Sambuc 
5f4a2713aSLionel Sambuc void dispatch_once(dispatch_block_t);
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc class Zone {
8f4a2713aSLionel Sambuc public:
9f4a2713aSLionel Sambuc   Zone();
10f4a2713aSLionel Sambuc   ~Zone();
11f4a2713aSLionel Sambuc };
12f4a2713aSLionel Sambuc 
Zone()13f4a2713aSLionel Sambuc Zone::Zone() {
14f4a2713aSLionel Sambuc     dispatch_once(^{});
15f4a2713aSLionel Sambuc     dispatch_once(^{});
16f4a2713aSLionel Sambuc }
17f4a2713aSLionel Sambuc 
~Zone()18f4a2713aSLionel Sambuc Zone::~Zone() {
19f4a2713aSLionel Sambuc     dispatch_once(^{});
20f4a2713aSLionel Sambuc     dispatch_once(^{});
21f4a2713aSLionel Sambuc }
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc class X : public virtual Zone {
24f4a2713aSLionel Sambuc   X();
25f4a2713aSLionel Sambuc   ~X();
26f4a2713aSLionel Sambuc };
27f4a2713aSLionel Sambuc 
X()28f4a2713aSLionel Sambuc X::X() {
29f4a2713aSLionel Sambuc     dispatch_once(^{});
30f4a2713aSLionel Sambuc     dispatch_once(^{});
31f4a2713aSLionel Sambuc };
32f4a2713aSLionel Sambuc 
~X()33f4a2713aSLionel Sambuc X::~X() {
34f4a2713aSLionel Sambuc     dispatch_once(^{});
35f4a2713aSLionel Sambuc     dispatch_once(^{});
36f4a2713aSLionel Sambuc };
37f4a2713aSLionel Sambuc 
38f4a2713aSLionel Sambuc 
39f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN4ZoneC2Ev_block_invoke
40f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN4ZoneC2Ev_block_invoke_
41f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN4ZoneD2Ev_block_invoke
42f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN4ZoneD2Ev_block_invoke_
43f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN1XC2Ev_block_invoke
44f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN1XC2Ev_block_invoke_
45*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke
46*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define internal void @___ZN1XC1Ev_block_invoke_
47f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN1XD2Ev_block_invoke
48f4a2713aSLionel Sambuc // CHECK-LABEL: define internal void @___ZN1XD2Ev_block_invoke_
49