]> granicus.if.org Git - clang/commitdiff
There are some crazy cases that LookupMethodInReceiverType
authorJohn McCall <rjmccall@apple.com>
Mon, 7 Nov 2011 22:49:50 +0000 (22:49 +0000)
committerJohn McCall <rjmccall@apple.com>
Mon, 7 Nov 2011 22:49:50 +0000 (22:49 +0000)
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

lib/Sema/SemaPseudoObject.cpp
test/SemaObjC/property.m

index b3ed145b155c14aa24f822f122ac629775158474..cf43fcad0553d1f6a3e603373190e163db269184 100644 (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);
 }
 
index 7d1cb7a3616031a7242f25597fd8b8944d0e8f37..a43811d8242bc31abf01911e493d501abd0cf0bf 100644 (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