ObjectiveC. Fixes a bogus warning of unused backing

ivar when property belongs to a super class and
currnt class happens to have a method with same name as
property. // rdar//15473432

llvm-svn: 194830
This commit is contained in:
Fariborz Jahanian 2013-11-15 17:48:00 +00:00
parent a6dedc6ccc
commit 617e49ad59
2 changed files with 35 additions and 1 deletions

View File

@ -3510,8 +3510,17 @@ Sema::GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method,
Method = IDecl->lookupMethod(Method->getSelector(), true);
if (!Method || !Method->isPropertyAccessor())
return 0;
if ((PDecl = Method->findPropertyDecl()))
if ((PDecl = Method->findPropertyDecl())) {
if (!PDecl->getDeclContext())
return 0;
// Make sure property belongs to accessor's class and not to
// one of its super classes.
if (const ObjCInterfaceDecl *CID =
dyn_cast<ObjCInterfaceDecl>(PDecl->getDeclContext()))
if (CID != IDecl)
return 0;
return PDecl->getPropertyIvarDecl();
}
return 0;
}

View File

@ -49,3 +49,28 @@
okIvar = newT;
}
@end
// rdar://15473432
typedef char BOOL;
@interface CalDAVServerVersion {
BOOL _supportsTimeRangeFilterWithoutEndDate;
}
@property (nonatomic, readonly,nonatomic) BOOL supportsTimeRangeFilterWithoutEndDate;
@end
@interface CalDAVConcreteServerVersion : CalDAVServerVersion {
}
@end
@interface CalendarServerVersion : CalDAVConcreteServerVersion
@end
@implementation CalDAVServerVersion
@synthesize supportsTimeRangeFilterWithoutEndDate=_supportsTimeRangeFilterWithoutEndDate;
@end
@implementation CalendarServerVersion
-(BOOL)supportsTimeRangeFilterWithoutEndDate {
return 0;
}
@end