mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-29 08:31:13 +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.
|
// Explicit ivar refs need to have a cast inserted.
|
||||||
// FIXME: consider sharing some of this code with the code above.
|
// FIXME: consider sharing some of this code with the code above.
|
||||||
if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
|
if (IV->isArrow()) {
|
||||||
ObjCInterfaceType *iFaceDecl = dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
|
ObjCInterfaceType *iFaceDecl =
|
||||||
|
dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
|
||||||
// lookup which class implements the instance variable.
|
// lookup which class implements the instance variable.
|
||||||
ObjCInterfaceDecl *clsDeclared = 0;
|
ObjCInterfaceDecl *clsDeclared = 0;
|
||||||
iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
|
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
|
// radar 7490331
|
||||||
|
|
||||||
@interface Foo {
|
@interface Foo {
|
||||||
@ -10,6 +10,11 @@
|
|||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation Foo
|
@implementation Foo
|
||||||
|
// radar 7522803
|
||||||
|
static void foo(id bar) {
|
||||||
|
int i = ((Foo *)bar)->a;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)bar {
|
- (void)bar {
|
||||||
a = 42;
|
a = 42;
|
||||||
[self baz:b];
|
[self baz:b];
|
||||||
|
Loading…
Reference in New Issue
Block a user