[cfe-commits] r144031 - in /cfe/trunk: lib/Sema/SemaPseudoObject.cpp test/SemaObjC/property.m
John McCall
rjmccall at apple.com
Mon Nov 7 14:49:51 PST 2011
Author: rjmccall
Date: Mon Nov 7 16:49:50 2011
New Revision: 144031
URL: http://llvm.org/viewvc/llvm-project?rev=144031&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaPseudoObject.cpp
cfe/trunk/test/SemaObjC/property.m
Modified: cfe/trunk/lib/Sema/SemaPseudoObject.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaPseudoObject.cpp?rev=144031&r1=144030&r2=144031&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaPseudoObject.cpp (original)
+++ cfe/trunk/lib/Sema/SemaPseudoObject.cpp Mon Nov 7 16:49:50 2011
@@ -418,7 +418,14 @@
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);
}
Modified: cfe/trunk/test/SemaObjC/property.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property.m?rev=144031&r1=144030&r2=144031&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property.m (original)
+++ cfe/trunk/test/SemaObjC/property.m Mon Nov 7 16:49:50 2011
@@ -65,3 +65,12 @@
// rdar://10127639
@synthesize window; // expected-error {{missing context for property implementation declaration}}
+
+// rdar://10408414
+Class test6_getClass();
+ at interface Test6
+ at end
+ at implementation Test6
++ (float) globalValue { return 5.0f; }
++ (float) gv { return test6_getClass().globalValue; }
+ at end
More information about the cfe-commits
mailing list