]> granicus.if.org Git - clang/commitdiff
ObjectiveC. Remove warning on mismatched methods
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 10 Jan 2014 19:27:21 +0000 (19:27 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 10 Jan 2014 19:27:21 +0000 (19:27 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198952 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/selector-3.m

index 974533e44f79a72019e46a0854b7ed158a983869..a43ce7f32b2968c4393282f6cdff499e7fd262af 100644 (file)
@@ -856,8 +856,6 @@ def warn_auto_implicit_atomic_property : Warning<
   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>;
 
index 733f0262e2bdbd683bac0ccd840bcb88f6e1d9e8..d5ba71a3d18fb7f864d8ece6ed318b5e499eb0b2 100644 (file)
@@ -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);
index 5bd0ac51a7acf9e445b586de79b402876d0c2fe7..34d1965fa580e48c4b26dc3055b648b31b6470bc 100644 (file)
@@ -2469,51 +2469,6 @@ Sema::SelectorsForTypoCorrection(Selector Sel,
   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::DiagnoseUseOfUnimplementedSelectors() {
       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.
index d782c784f1de742d62bfe4461c4ee1916402a939..35a465170704a36536650b5c755d8020709f418c 100644 (file)
@@ -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