Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Rewriter / inner-block-helper-funcs.mm
blob6bbfc5fee72f40fa3e7d40ee75a4d3d0e4c02a72
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); };
13   id innerObject = 0;
15   printf("innerBlock is %x\n", innerBlock);
17   dispatch_block_t wrapperBlock = ^{
18     printf("innerBlock is %x %x\n", innerBlock, innerObject);
19   };
21   wrapperBlock();
23   dispatch_block_t copiedBlock = Block_copy(wrapperBlock);
24   copiedBlock();
26   return 0;
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