diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-04-24 17:06:38 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-04-24 17:06:38 +0000 |
commit | c775b1a0702621e297d00452a897381c8bf10f3f (patch) | |
tree | db6a490ec9e3792662bb5609f463c92184619748 /lib/AST | |
parent | 94d6ad7b65b59f834bbc40e0caed5ceebca11932 (diff) |
Objective-C: When reporting on missing property accessor implementation in
categories, do not report when they are declared in primary class,
class's protocol, or one of it super classes. This is because,
its class is going to implement them. // rdar://13713098
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180198 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index 08c59b567d..43a128137b 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -445,7 +445,8 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass( /// the class, its categories, and its super classes (using a linear search). ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, bool isInstance, - bool shallowCategoryLookup) const { + bool shallowCategoryLookup, + bool CategoryLookup) const { // FIXME: Should make sure no callers ever do this. if (!hasDefinition()) return 0; @@ -468,23 +469,24 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, return MethodDecl; // Didn't find one yet - now look through categories. - for (ObjCInterfaceDecl::visible_categories_iterator + if (CategoryLookup) + for (ObjCInterfaceDecl::visible_categories_iterator Cat = ClassDecl->visible_categories_begin(), CatEnd = ClassDecl->visible_categories_end(); - Cat != CatEnd; ++Cat) { - if ((MethodDecl = Cat->getMethod(Sel, isInstance))) - return MethodDecl; - - if (!shallowCategoryLookup) { - // Didn't find one yet - look through protocols. - const ObjCList<ObjCProtocolDecl> &Protocols = - Cat->getReferencedProtocols(); - for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(), - E = Protocols.end(); I != E; ++I) - if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance))) - return MethodDecl; + Cat != CatEnd; ++Cat) { + if ((MethodDecl = Cat->getMethod(Sel, isInstance))) + return MethodDecl; + + if (!shallowCategoryLookup) { + // Didn't find one yet - look through protocols. + const ObjCList<ObjCProtocolDecl> &Protocols = + Cat->getReferencedProtocols(); + for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(), + E = Protocols.end(); I != E; ++I) + if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance))) + return MethodDecl; + } } - } ClassDecl = ClassDecl->getSuperClass(); } |