There are some crazy cases that LookupMethodInReceiverType

doesn't duplicate, but they all surface as implicit
properties.  It's also a useful optimization to not
duplicate the implicit getter lookup.  So, trust the
getter lookup that was already done in these cases.

llvm-svn: 144031
This commit is contained in:
John McCall
2011-11-07 22:49:50 +00:00
parent c64b5c7c47
commit cfef546d40
2 changed files with 17 additions and 1 deletions

View File

@@ -418,7 +418,14 @@ static ObjCMethodDecl *LookupMethodInReceiverType(Sema &S, Selector sel,
bool ObjCPropertyOpBuilder::findGetter() {
if (Getter) return true;
Getter = LookupMethodInReceiverType(S, RefExpr->getGetterSelector(), RefExpr);
// For implicit properties, just trust the lookup we already did.
if (RefExpr->isImplicitProperty()) {
Getter = RefExpr->getImplicitPropertyGetter();
return (Getter != 0);
}
ObjCPropertyDecl *prop = RefExpr->getExplicitProperty();
Getter = LookupMethodInReceiverType(S, prop->getGetterName(), RefExpr);
return (Getter != 0);
}

View File

@@ -65,3 +65,12 @@ typedef id BYObjectIdentifier;
// rdar://10127639
@synthesize window; // expected-error {{missing context for property implementation declaration}}
// rdar://10408414
Class test6_getClass();
@interface Test6
@end
@implementation Test6
+ (float) globalValue { return 5.0f; }
+ (float) gv { return test6_getClass().globalValue; }
@end