From: Fariborz Jahanian Date: Thu, 27 Mar 2014 21:59:01 +0000 (+0000) Subject: Objective-C. Make multiple selector warning X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=297e5869c5c643cb01a535b626ed787e8ecb4a72;p=clang Objective-C. Make multiple selector warning an opt-in option under -Wselector-type-mismatch. // rdar://16445728 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204965 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 9094e9b323..f7efbbd2ef 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -905,8 +905,9 @@ def warn_unimplemented_selector: Warning< def warn_unimplemented_protocol_method : Warning< "method %0 in protocol %1 not implemented">, InGroup; def warning_multiple_selectors: Warning< - "several methods with selector %0 of mismatched types are found for the @selector expression">, - InGroup; + "several methods with selector %0 of mismatched types are found " + "for the @selector expression">, + InGroup, DefaultIgnore; // C++ declarations def err_static_assert_expression_is_not_constant : Error< "static_assert expression is not an integral constant expression">; diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index d878179d78..5bffdd1573 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -1003,8 +1003,8 @@ static bool HelperToDiagnoseMismatchedMethodsInGlobalPool(Sema &S, static void DiagnoseMismatchedSelectors(Sema &S, SourceLocation AtLoc, ObjCMethodDecl *Method) { - unsigned DIAG = diag::warning_multiple_selectors; - if (S.Diags.getDiagnosticLevel(DIAG, SourceLocation()) + if (S.Diags.getDiagnosticLevel(diag::warning_multiple_selectors, + SourceLocation()) == DiagnosticsEngine::Ignored) return; bool Warned = false; diff --git a/test/SemaObjC/selector-1.m b/test/SemaObjC/selector-1.m index faa742616d..8dedcdb5ea 100644 --- a/test/SemaObjC/selector-1.m +++ b/test/SemaObjC/selector-1.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -verify %s +// RUN: %clang_cc1 -Wselector-type-mismatch -verify %s @interface I - (id) compare: (char) arg1; // expected-note {{method 'compare:' declared here}}