diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-08 22:59:25 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-08 22:59:25 +0000 |
| commit | 73853e5babc682ae4adf3b258065c75cb0037254 (patch) | |
| tree | 95be33987d307b53fd8ab71fcb62ce65a748a9fa | |
| parent | bfde8dc6275748d279eb890709aafe6a32fc1c43 (diff) | |
| download | bcm5719-llvm-73853e5babc682ae4adf3b258065c75cb0037254.tar.gz bcm5719-llvm-73853e5babc682ae4adf3b258065c75cb0037254.zip | |
Method implemented in class's implementation may implement
one declared in class's extension and not one declared
in class's superclass. This supresses a bogus warning on
method type mismatch.
Fixes //rdar: // 8530080
llvm-svn: 116118
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 9 | ||||
| -rw-r--r-- | clang/test/SemaObjC/metod-in-class-extension-impl.m | 20 |
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 + |

