diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-04-05 22:14:12 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-04-05 22:14:12 +0000 |
commit | bf393be8a0b8b573ceb23ed19ac953832a2a69e4 (patch) | |
tree | 1d637f75accac73f5e94a90e7e89b6d1124794c4 /lib/AST | |
parent | 856183c79a6fdb0291315223fb338d4895ba0cf1 (diff) |
objective-c: Don't warn when a category does not implement a method
declared in its adopted protocol when another category declares it
because that category will implement it. // rdar://11186449
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index a92c624b4c..2370d3c018 100644 --- a/lib/AST/DeclObjC.cpp +++ b/lib/AST/DeclObjC.cpp @@ -316,9 +316,9 @@ ObjCInterfaceDecl *ObjCInterfaceDecl::lookupInheritedClass( /// lookupMethod - This method returns an instance/class method by looking in /// the class, its categories, and its super classes (using a linear search). -ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, - bool isInstance, - bool noCategoryLookup) const { +ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, + bool isInstance, + bool shallowCategoryLookup) const { // FIXME: Should make sure no callers ever do this. if (!hasDefinition()) return 0; @@ -339,13 +339,14 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, I != E; ++I) if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance))) return MethodDecl; - if (!noCategoryLookup) { - // Didn't find one yet - now look through categories. - ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList(); - while (CatDecl) { - if ((MethodDecl = CatDecl->getMethod(Sel, isInstance))) - return MethodDecl; + + // Didn't find one yet - now look through categories. + ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList(); + while (CatDecl) { + if ((MethodDecl = CatDecl->getMethod(Sel, isInstance))) + return MethodDecl; + if (!shallowCategoryLookup) { // Didn't find one yet - look through protocols. const ObjCList<ObjCProtocolDecl> &Protocols = CatDecl->getReferencedProtocols(); @@ -353,9 +354,10 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupMethod(Selector Sel, E = Protocols.end(); I != E; ++I) if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance))) return MethodDecl; - CatDecl = CatDecl->getNextClassCategory(); } + CatDecl = CatDecl->getNextClassCategory(); } + ClassDecl = ClassDecl->getSuperClass(); } return NULL; |