summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp9
-rw-r--r--clang/test/SemaObjC/metod-in-class-extension-impl.m20
2 files changed, 29 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 09502a49233..74bd00340c6 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -924,7 +924,16 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap,
WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl);
}
}
+
if (ObjCInterfaceDecl *I = dyn_cast<ObjCInterfaceDecl> (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<ObjCCategoryDecl *>(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 00000000000..c205322dec9
--- /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 <ViewDelegate>)delegate;
+@end
+
+@interface FooTextView : NSTextView
+@end
+
+@interface FooTextView()
+- (id)delegate;
+@end
+
+@implementation FooTextView
+- (id)delegate {return 0; }
+@end
+
OpenPOWER on IntegriCloud