diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 09502a49233e..74bd00340c69 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -924,7 +924,16 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet &InsMap, WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl); } } + if (ObjCInterfaceDecl *I = dyn_cast (CDecl)) { + // Also methods in class extensions need be looked at next. + for (const ObjCCategoryDecl *ClsExtDecl = I->getFirstClassExtension(); + ClsExtDecl; ClsExtDecl = ClsExtDecl->getNextClassExtension()) + MatchAllMethodDeclarations(InsMap, ClsMap, InsMapSeen, ClsMapSeen, + IMPDecl, + const_cast(ClsExtDecl), + IncompleteImpl, false); + // Check for any implementation of a methods declared in protocol. for (ObjCInterfaceDecl::all_protocol_iterator PI = I->all_referenced_protocol_begin(), diff --git a/clang/test/SemaObjC/metod-in-class-extension-impl.m b/clang/test/SemaObjC/metod-in-class-extension-impl.m new file mode 100644 index 000000000000..c205322dec9d --- /dev/null +++ b/clang/test/SemaObjC/metod-in-class-extension-impl.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://8530080 + +@protocol ViewDelegate @end + +@interface NSTextView +- (id )delegate; +@end + +@interface FooTextView : NSTextView +@end + +@interface FooTextView() +- (id)delegate; +@end + +@implementation FooTextView +- (id)delegate {return 0; } +@end +