forked from OSchip/llvm-project
Fix rewriting of ivars. Fixes radar 7490331.
llvm-svn: 92924
This commit is contained in:
parent
49c8da95a3
commit
0f3aecf272
|
@ -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(),
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue