[cfe-commits] r151371 - in /cfe/trunk: lib/Rewrite/RewriteModernObjC.cpp test/Rewriter/rewrite-modern-block-ivar-call.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Feb 24 09:35:35 PST 2012
Author: fjahanian
Date: Fri Feb 24 11:35:35 2012
New Revision: 151371
URL: http://llvm.org/viewvc/llvm-project?rev=151371&view=rev
Log:
objc modern translator. Fixes writing of block pointer ivar access.
Added:
cfe/trunk/test/Rewriter/rewrite-modern-block-ivar-call.mm
Modified:
cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
Modified: cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp?rev=151371&r1=151370&r2=151371&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteModernObjC.cpp Fri Feb 24 11:35:35 2012
@@ -6469,8 +6469,10 @@
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,
Added: cfe/trunk/test/Rewriter/rewrite-modern-block-ivar-call.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-modern-block-ivar-call.mm?rev=151371&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-modern-block-ivar-call.mm (added)
+++ cfe/trunk/test/Rewriter/rewrite-modern-block-ivar-call.mm Fri Feb 24 11:35:35 2012
@@ -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
+
+ at interface Foo {
+ void (^_block)(void);
+}
+ at end
+
+ at implementation Foo
+- (void)bar {
+ _block();
+}
+ at 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)));
More information about the cfe-commits
mailing list