mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-04 00:06:50 +00:00
objc modern translator. Fixes writing of block pointer ivar access.
llvm-svn: 151371
This commit is contained in:
parent
e8dd130762
commit
dd5a59baed
@ -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,
|
||||
|
17
clang/test/Rewriter/rewrite-modern-block-ivar-call.mm
Normal file
17
clang/test/Rewriter/rewrite-modern-block-ivar-call.mm
Normal 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)));
|
Loading…
x
Reference in New Issue
Block a user