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. llvm-svn: 57995
This commit is contained in:
parent
c49d71ea61
commit
1df62692f2
|
@ -977,6 +977,13 @@ ActOnMemberReferenceExpr(ExprTy *Base, SourceLocation OpLoc,
|
|||
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.
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
// RUN: clang -fsyntax-only -verify %s
|
||||
|
||||
@interface NSSound
|
||||
@end
|
||||
@interface NSFont
|
||||
@end
|
||||
|
||||
@interface NSSound (Adds)
|
||||
@end
|
||||
|
||||
@implementation NSSound (Adds)
|
||||
- foo {
|
||||
return self;
|
||||
}
|
||||
- (void)setFoo:obj {
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSFont (Adds)
|
||||
|
||||
- xx {
|
||||
NSSound *x;
|
||||
id o;
|
||||
|
||||
o = [x foo];
|
||||
o = x.foo;
|
||||
[x setFoo:o];
|
||||
x.foo = o;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue