[cfe-commits] r116118 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/metod-in-class-extension-impl.m
Fariborz Jahanian
fjahanian at apple.com
Fri Oct 8 15:59:26 PDT 2010
Author: fjahanian
Date: Fri Oct 8 17:59:25 2010
New Revision: 116118
URL: http://llvm.org/viewvc/llvm-project?rev=116118&view=rev
Log:
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
Added:
cfe/trunk/test/SemaObjC/metod-in-class-extension-impl.m
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=116118&r1=116117&r2=116118&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Oct 8 17:59:25 2010
@@ -924,7 +924,16 @@
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(),
Added: cfe/trunk/test/SemaObjC/metod-in-class-extension-impl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/metod-in-class-extension-impl.m?rev=116118&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/metod-in-class-extension-impl.m (added)
+++ cfe/trunk/test/SemaObjC/metod-in-class-extension-impl.m Fri Oct 8 17:59:25 2010
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+// rdar://8530080
+
+ at protocol ViewDelegate @end
+
+ at interface NSTextView
+- (id <ViewDelegate>)delegate;
+ at end
+
+ at interface FooTextView : NSTextView
+ at end
+
+ at interface FooTextView()
+- (id)delegate;
+ at end
+
+ at implementation FooTextView
+- (id)delegate {return 0; }
+ at end
+
More information about the cfe-commits
mailing list