[cfe-commits] r136602 - /cfe/trunk/test/Rewriter/inner-block-helper-funcs.mm
Fariborz Jahanian
fjahanian at apple.com
Sun Jul 31 13:27:32 PDT 2011
Author: fjahanian
Date: Sun Jul 31 15:27:31 2011
New Revision: 136602
URL: http://llvm.org/viewvc/llvm-project?rev=136602&view=rev
Log:
Test for // rdar://9846759
Added:
cfe/trunk/test/Rewriter/inner-block-helper-funcs.mm
Added: cfe/trunk/test/Rewriter/inner-block-helper-funcs.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/inner-block-helper-funcs.mm?rev=136602&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/inner-block-helper-funcs.mm (added)
+++ cfe/trunk/test/Rewriter/inner-block-helper-funcs.mm Sun Jul 31 15:27:31 2011
@@ -0,0 +1,32 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: FileCheck -check-prefix LP --input-file=%t-rw.cpp %s
+// rdar://9846759
+
+typedef void (^dispatch_block_t)(void);
+
+extern int printf(const char*, ...);
+
+extern "C" dispatch_block_t Block_copy(dispatch_block_t aBlock);
+
+int main (int argc, char *argv[]) {
+
+ dispatch_block_t innerBlock = ^{printf("argc = %d\n", argc); };
+ id innerObject = 0;
+
+ printf("innerBlock is %x\n", innerBlock);
+
+ dispatch_block_t wrapperBlock = ^{
+ printf("innerBlock is %x %x\n", innerBlock, innerObject);
+ };
+
+ wrapperBlock();
+
+ dispatch_block_t copiedBlock = Block_copy(wrapperBlock);
+ copiedBlock();
+
+ return 0;
+}
+// CHECK-LP: _Block_object_assign((void*)&dst->innerBlock, (void*)src->innerBlock, 7
+// CHECK-LP: _Block_object_dispose((void*)src->innerBlock, 7
+// CHECK-LP: _Block_object_assign((void*)&dst->innerObject, (void*)src->innerObject, 3
+// CHECK-LP: _Block_object_dispose((void*)src->innerObject, 3
More information about the cfe-commits
mailing list