Fix rewriting of a method when return type is

a block pointer type. Fixes radar 7682149.

llvm-svn: 97008
This commit is contained in:
Fariborz Jahanian 2010-02-24 01:25:40 +00:00
parent a2d8c97b65
commit f89eb2b9c2
2 changed files with 29 additions and 0 deletions

View File

@ -2815,6 +2815,10 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
}
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();
}

View File

@ -3,6 +3,7 @@
// radar 7638400
typedef void * id;
void *sel_registerName(const char *);
@interface X
@end
@ -33,3 +34,27 @@ void *_Block_copy(const void *aBlock);
void x(void (^block)(void)) {
block = ((__typeof(block))_Block_copy((const void *)(block)));
}
// radar 7682149
@interface Y {
@private
id _private;
}
- (void (^)(void))f;
@end
typedef void (^void_block_t)(void);
@interface YY {
void_block_t __completion;
}
@property (copy) void_block_t f;
@end
@implementation Y
- (void (^)(void))f {
return [_private f];
}
@end