1 // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
2 // RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-rw.cpp %s
4 typedef void (^dispatch_block_t)(void);
6 extern int printf(const char*, ...);
8 extern "C" dispatch_block_t Block_copy(dispatch_block_t aBlock);
10 int main (int argc, char *argv[]) {
12 dispatch_block_t innerBlock = ^{printf("argc = %d\n", argc); };
15 printf("innerBlock is %x\n", innerBlock);
17 dispatch_block_t wrapperBlock = ^{
18 printf("innerBlock is %x %x\n", innerBlock, innerObject);
23 dispatch_block_t copiedBlock = Block_copy(wrapperBlock);
28 // CHECK-LP: _Block_object_assign((void*)&dst->innerBlock, (void*)src->innerBlock, 7
29 // CHECK-LP: _Block_object_dispose((void*)src->innerBlock, 7
30 // CHECK-LP: _Block_object_assign((void*)&dst->innerObject, (void*)src->innerObject, 3
31 // CHECK-LP: _Block_object_dispose((void*)src->innerObject, 3