mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-25 14:50:26 +00:00
Fixup rewrite of ivars accessed via an explicit object
in a function. Fixes radar 7522803. llvm-svn: 93159
This commit is contained in:
parent
3a55686345
commit
9146e44124
@ -1235,8 +1235,9 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
|
||||
|
||||
// Explicit ivar refs need to have a cast inserted.
|
||||
// FIXME: consider sharing some of this code with the code above.
|
||||
if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
|
||||
ObjCInterfaceType *iFaceDecl = dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
|
||||
if (IV->isArrow()) {
|
||||
ObjCInterfaceType *iFaceDecl =
|
||||
dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
|
||||
// lookup which class implements the instance variable.
|
||||
ObjCInterfaceDecl *clsDeclared = 0;
|
||||
iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
// RUN: %clang_cc1 -rewrite-objc %s -o -
|
||||
// RUN: %clang_cc1 -rewrite-objc -fms-extensions %s -o -
|
||||
// radar 7490331
|
||||
|
||||
@interface Foo {
|
||||
@ -10,6 +10,11 @@
|
||||
@end
|
||||
|
||||
@implementation Foo
|
||||
// radar 7522803
|
||||
static void foo(id bar) {
|
||||
int i = ((Foo *)bar)->a;
|
||||
}
|
||||
|
||||
- (void)bar {
|
||||
a = 42;
|
||||
[self baz:b];
|
||||
|
Loading…
Reference in New Issue
Block a user