Author: snaroff
Date: Wed Oct 22 14:16:27 2008
New Revision: 57995
URL: http://llvm.org/viewvc/llvm-project?rev=57995&view=rev
Log:
Fix <rdar://problem/6257675> error: member reference base type ('NSUserDefaults
*') is not a structure or union.
Teach Sema::ActOnMemberReferenceExpr() to look through local category
implementations associated with the class.
Added:
cfe/trunk/test/SemaObjC/property-11.m
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=57995&r1=57994&r2=57995&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Oct 22 14:16:27 2008
@@ -977,6 +977,13 @@
ObjCImplementations[ClassDecl->getIdentifier()])
Getter = ImpDecl->getInstanceMethod(Sel);
+ // Look through local category implementations associated with the class.
+ if (!Getter) {
+ for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Getter; i++) {
+ if (ObjCCategoryImpls[i]->getClassInterface() == IFace)
+ Getter = ObjCCategoryImpls[i]->getInstanceMethod(Sel);
+ }
+ }
if (Getter) {
// If we found a getter then this may be a valid dot-reference, we
// need to also look for the matching setter.
Added: cfe/trunk/test/SemaObjC/property-11.m
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-11.m?rev=57995&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/property-11.m (added)
+++ cfe/trunk/test/SemaObjC/property-11.m Wed Oct 22 14:16:27 2008
@@ -0,0 +1,32 @@
+// RUN: clang -fsyntax-only -verify %s
+
[EMAIL PROTECTED] NSSound
[EMAIL PROTECTED]
[EMAIL PROTECTED] NSFont
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] NSSound (Adds)
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] NSSound (Adds)
+- foo {
+ return self;
+}
+- (void)setFoo:obj {
+}
[EMAIL PROTECTED]
+
[EMAIL PROTECTED] NSFont (Adds)
+
+- xx {
+ NSSound *x;
+ id o;
+
+ o = [x foo];
+ o = x.foo;
+ [x setFoo:o];
+ x.foo = o;
+}
+
[EMAIL PROTECTED]
+
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits