| 1 |
// RUN: %clang_cc1 %s -fblocks -triple x86_64-apple-darwin -emit-llvm -o - | FileCheck %s |
| 2 |
|
| 3 |
extern "C" { |
| 4 |
extern "C" void *_Block_copy(const void *aBlock); |
| 5 |
extern "C" void _Block_release(const void *aBlock); |
| 6 |
} |
| 7 |
|
| 8 |
class A { |
| 9 |
public: |
| 10 |
int x; |
| 11 |
A(const A &o); |
| 12 |
A(); |
| 13 |
virtual ~A(); |
| 14 |
void hello() const; |
| 15 |
}; |
| 16 |
|
| 17 |
int |
| 18 |
main() |
| 19 |
{ |
| 20 |
A a; |
| 21 |
void (^c)(void) = ((__typeof(^{ a.hello(); }))_Block_copy((const void *)(^{ a.hello(); }))); |
| 22 |
c(); |
| 23 |
_Block_release((const void *)(c)); |
| 24 |
return 0; |
| 25 |
} |
| 26 |
|
| 27 |
// CHECK-LABEL: define linkonce_odr hidden void @__copy_helper_block_ |
| 28 |
// CHECK: call void @_ZN1AC1ERKS_ |
| 29 |
|
| 30 |
|
| 31 |
// CHECK-LABEL:define linkonce_odr hidden void @__destroy_helper_block_ |
| 32 |
// CHECK: call void @_ZN1AD1Ev |