diff options
author | John McCall <rjmccall@apple.com> | 2011-11-07 22:49:50 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-11-07 22:49:50 +0000 |
commit | dc4df51d32dea56fbec79037570832dffbcc14e6 (patch) | |
tree | 4638fb93d4d88c439a475a9c754d35a52dd6161b | |
parent | 1a8a8cbea639d0519f06285e12f64904d1158305 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144031 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaPseudoObject.cpp | 9 | ||||
-rw-r--r-- | test/SemaObjC/property.m | 9 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/Sema/SemaPseudoObject.cpp b/lib/Sema/SemaPseudoObject.cpp index b3ed145b15..cf43fcad05 100644 --- a/lib/Sema/SemaPseudoObject.cpp +++ b/lib/Sema/SemaPseudoObject.cpp @@ -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); } diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m index 7d1cb7a361..a43811d824 100644 --- a/test/SemaObjC/property.m +++ b/test/SemaObjC/property.m @@ -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 |