Fix rewriting of ivars. Fixes radar 7490331.

llvm-svn: 92924
This commit is contained in:
Fariborz Jahanian 2010-01-07 18:18:32 +00:00
parent 49c8da95a3
commit 0f3aecf272
2 changed files with 23 additions and 2 deletions

View File

@ -1183,10 +1183,11 @@ Stmt *RewriteObjC::RewritePropertyGetter(ObjCPropertyRefExpr *PropRefExpr) {
Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
SourceLocation OrigStart) {
ObjCIvarDecl *D = IV->getDecl();
const Expr *BaseExpr = IV->getBase();
if (CurMethodDef) {
if (const PointerType *pType = IV->getBase()->getType()->getAs<PointerType>()) {
if (IV->isArrow()) {
ObjCInterfaceType *iFaceDecl =
dyn_cast<ObjCInterfaceType>(pType->getPointeeType());
dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
// lookup which class implements the instance variable.
ObjCInterfaceDecl *clsDeclared = 0;
iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),

View File

@ -0,0 +1,20 @@
// RUN: %clang_cc1 -rewrite-objc %s -o -
// radar 7490331
@interface Foo {
int a;
id b;
}
- (void)bar;
- (void)baz:(id)q;
@end
@implementation Foo
- (void)bar {
a = 42;
[self baz:b];
}
- (void)baz:(id)q {
}
@end