r198952 - ObjectiveC. Remove warning on mismatched methods
Fariborz Jahanian
fjahanian at apple.com
Fri Jan 10 11:27:21 PST 2014
Author: fjahanian
Date: Fri Jan 10 13:27:21 2014
New Revision: 198952
URL: http://llvm.org/viewvc/llvm-project?rev=198952&view=rev
Log:
ObjectiveC. Remove warning on mismatched methods
which may belong to unrelated classes. It was
primarily intended for miuse of @selector expression.
But warning is too noisy and will be issued when
an actual @selector is used. // rdar://15740134
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/selector-3.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=198952&r1=198951&r2=198952&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jan 10 13:27:21 2014
@@ -856,8 +856,6 @@ def warn_auto_implicit_atomic_property :
InGroup<ImplicitAtomic>, DefaultIgnore;
def warn_unimplemented_selector: Warning<
"creating selector for nonexistent method %0">, InGroup<Selector>, DefaultIgnore;
-def warning_multiple_selectors: Warning<
- "multiple selectors named %0 found">, InGroup<SelectorTypeMismatch>, DefaultIgnore;
def warn_unimplemented_protocol_method : Warning<
"method %0 in protocol %1 not implemented">, InGroup<Protocol>;
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=198952&r1=198951&r2=198952&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Fri Jan 10 13:27:21 2014
@@ -2785,12 +2785,6 @@ public:
const ObjCMethodDecl *SelectorsForTypoCorrection(Selector Sel,
QualType ObjectType=QualType());
-
- /// DiagnoseMismatchedMethodsInGlobalPool - This routine goes through list of
- /// methods in global pool and issues diagnostic on identical selectors which
- /// have mismathched types.
- void DiagnoseMismatchedMethodsInGlobalPool();
-
/// LookupImplementedMethodInGlobalPool - Returns the method which has an
/// implementation.
ObjCMethodDecl *LookupImplementedMethodInGlobalPool(Selector Sel);
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=198952&r1=198951&r2=198952&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Jan 10 13:27:21 2014
@@ -2469,51 +2469,6 @@ Sema::SelectorsForTypoCorrection(Selecto
return (SelectedMethods.size() == 1) ? SelectedMethods[0] : NULL;
}
-static void
-HelperToDiagnoseMismatchedMethodsInGlobalPool(Sema &S,
- ObjCMethodList &MethList) {
- ObjCMethodList *M = &MethList;
- ObjCMethodDecl *TargetMethod = M->Method;
- while (TargetMethod &&
- isa<ObjCImplDecl>(TargetMethod->getDeclContext())) {
- M = M->getNext();
- TargetMethod = M ? M->Method : 0;
- }
- if (!TargetMethod)
- return;
- bool FirstTime = true;
- for (M = M->getNext(); M; M=M->getNext()) {
- ObjCMethodDecl *MatchingMethodDecl = M->Method;
- if (isa<ObjCImplDecl>(MatchingMethodDecl->getDeclContext()))
- continue;
- if (!S.MatchTwoMethodDeclarations(TargetMethod,
- MatchingMethodDecl, Sema::MMS_loose)) {
- if (FirstTime) {
- FirstTime = false;
- S.Diag(TargetMethod->getLocation(), diag::warning_multiple_selectors)
- << TargetMethod->getSelector();
- }
- S.Diag(MatchingMethodDecl->getLocation(), diag::note_also_found);
- }
- }
-}
-
-void Sema::DiagnoseMismatchedMethodsInGlobalPool() {
- unsigned DIAG = diag::warning_multiple_selectors;
- if (Diags.getDiagnosticLevel(DIAG, SourceLocation())
- == DiagnosticsEngine::Ignored)
- return;
- for (GlobalMethodPool::iterator b = MethodPool.begin(),
- e = MethodPool.end(); b != e; b++) {
- // first, instance methods
- ObjCMethodList &InstMethList = b->second.first;
- HelperToDiagnoseMismatchedMethodsInGlobalPool(*this, InstMethList);
- // second, class methods
- ObjCMethodList &ClsMethList = b->second.second;
- HelperToDiagnoseMismatchedMethodsInGlobalPool(*this, ClsMethList);
- }
-}
-
/// DiagnoseDuplicateIvars -
/// Check for duplicate ivars in the entire class at the start of
/// \@implementation. This becomes necesssary because class extension can
@@ -3470,8 +3425,6 @@ void Sema::DiagnoseUseOfUnimplementedSel
ReferencedSelectors[Sels[I].first] = Sels[I].second;
}
- DiagnoseMismatchedMethodsInGlobalPool();
-
// Warning will be issued only when selector table is
// generated (which means there is at lease one implementation
// in the TU). This is to match gcc's behavior.
Modified: cfe/trunk/test/SemaObjC/selector-3.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/selector-3.m?rev=198952&r1=198951&r2=198952&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/selector-3.m (original)
+++ cfe/trunk/test/SemaObjC/selector-3.m Fri Jan 10 13:27:21 2014
@@ -84,23 +84,23 @@ extern SEL MySelector(SEL s);
// rdar://14007194
@interface UxTechTest : NSObject
-- (int) invalidate : (id)Arg; // expected-warning {{multiple selectors named 'invalidate:' found}}
-+ (int) C_invalidate : (int)arg; // expected-warning {{multiple selectors named 'C_invalidate:' found}}
+- (int) invalidate : (id)Arg;
++ (int) C_invalidate : (int)arg;
@end
@interface UxTechTest(CAT)
-- (char) invalidate : (int)arg; // expected-note {{also found}}
-+ (int) C_invalidate : (char)arg; // expected-note {{also found}}
+- (char) invalidate : (int)arg;
++ (int) C_invalidate : (char)arg;
@end
@interface NSPort : NSObject
-- (double) invalidate : (void*)Arg1; // expected-note {{also found}}
-+ (int) C_invalidate : (id*)arg; // expected-note {{also found}}
+- (double) invalidate : (void*)Arg1;
++ (int) C_invalidate : (id*)arg;
@end
@interface USEText : NSPort
-- (int) invalidate : (int)arg; // expected-note {{also found}}
+- (int) invalidate : (int)arg;
@end
@implementation USEText
More information about the cfe-commits
mailing list