objc modern translator. Fixes writing of block pointer ivar access.

llvm-svn: 151371
This commit is contained in:
Fariborz Jahanian 2012-02-24 17:35:35 +00:00
parent e8dd130762
commit dd5a59baed
2 changed files with 20 additions and 1 deletions

View File

@ -6469,8 +6469,10 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) {
ParenExpr *PE = new (Context) ParenExpr(SourceLocation(),
SourceLocation(),
addExpr);
QualType IvarT = D->getType();
convertBlockPointerToFunctionPointer(IvarT);
QualType castT = Context->getPointerType(IvarT);
QualType castT = Context->getPointerType(D->getType());
castExpr = NoTypeInfoCStyleCastExpr(Context,
castT,
CK_BitCast,

View File

@ -0,0 +1,17 @@
// RUN: %clang_cc1 -E %s -o %t.m
// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %t.m -o %t-rw.cpp
// RUN: FileCheck --input-file=%t-rw.cpp %s
// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
@interface Foo {
void (^_block)(void);
}
@end
@implementation Foo
- (void)bar {
_block();
}
@end
// CHECK: ((void (*)(struct __block_impl *))((struct __block_impl *)(*(void (**)(void))((char *)self + OBJC_IVAR_$_Foo__block)))->FuncPtr)((struct __block_impl *)(*(void (**)(void))((char *)self + OBJC_IVAR_$_Foo__block)));