]> granicus.if.org Git - clang/commitdiff
Implemented rewriting of invocation of a block ivar.
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 18 Dec 2009 01:15:21 +0000 (01:15 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 18 Dec 2009 01:15:21 +0000 (01:15 +0000)
(radar 7482224).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91652 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/RewriteObjC.cpp
test/Rewriter/rewrite-block-ivar-call.mm [new file with mode: 0644]

index 6f8d40f0d1335e9977f816cdb2e0e7f2cb6d68b0..4ea081415fad80dd5f7cc29c40ff09b2edb4ae15 100644 (file)
@@ -4060,6 +4060,8 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
                                       SourceLocation(), cast<Expr>(RHSStmt), 
                                       Exp->getType());
     return CondExpr;
+  } else if (const ObjCIvarRefExpr *IRE = dyn_cast<ObjCIvarRefExpr>(BlockExp)) {
+    CPT = IRE->getType()->getAs<BlockPointerType>();
   } else {
     assert(1 && "RewriteBlockClass: Bad type");
   }
diff --git a/test/Rewriter/rewrite-block-ivar-call.mm b/test/Rewriter/rewrite-block-ivar-call.mm
new file mode 100644 (file)
index 0000000..80e8caa
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -o - %s
+
+@interface Foo {
+    void (^_block)(void);
+}
+@end
+
+@implementation Foo
+- (void)bar {
+    _block();
+}
+@end