[cfe-commits] r97008 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-block-pointer.mm
Fariborz Jahanian
fjahanian at apple.com
Tue Feb 23 17:25:40 PST 2010
Author: fjahanian
Date: Tue Feb 23 19:25:40 2010
New Revision: 97008
URL: http://llvm.org/viewvc/llvm-project?rev=97008&view=rev
Log:
Fix rewriting of a method when return type is
a block pointer type. Fixes radar 7682149.
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
cfe/trunk/test/Rewriter/rewrite-block-pointer.mm
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=97008&r1=97007&r2=97008&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Tue Feb 23 19:25:40 2010
@@ -2815,6 +2815,10 @@
}
returnType = OMD->getResultType()->isObjCQualifiedIdType()
? Context->getObjCIdType() : OMD->getResultType();
+ if (isTopLevelBlockPointerType(returnType)) {
+ const BlockPointerType *BPT = returnType->getAs<BlockPointerType>();
+ returnType = Context->getPointerType(BPT->getPointeeType());
+ }
} else {
returnType = Context->getObjCIdType();
}
Modified: cfe/trunk/test/Rewriter/rewrite-block-pointer.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-block-pointer.mm?rev=97008&r1=97007&r2=97008&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-block-pointer.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-block-pointer.mm Tue Feb 23 19:25:40 2010
@@ -3,6 +3,7 @@
// radar 7638400
typedef void * id;
+void *sel_registerName(const char *);
@interface X
@end
@@ -33,3 +34,27 @@
void x(void (^block)(void)) {
block = ((__typeof(block))_Block_copy((const void *)(block)));
}
+
+// radar 7682149
+ at interface Y {
+ at private
+ id _private;
+}
+- (void (^)(void))f;
+ at end
+
+typedef void (^void_block_t)(void);
+
+ at interface YY {
+ void_block_t __completion;
+}
+ at property (copy) void_block_t f;
+ at end
+
+ at implementation Y
+- (void (^)(void))f {
+ return [_private f];
+}
+
+ at end
+
More information about the cfe-commits
mailing list