From c10fe600a2edc27e041b68467420ebe6ccfc35b1 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Thu, 18 Dec 2014 19:41:11 +0000 Subject: [PATCH] Objective-C. Provide group name for warning on multiple selector names found during lookup. rdar://19265296 llvm-svn: 224536 --- clang/include/clang/Basic/DiagnosticGroups.td | 1 + clang/include/clang/Basic/DiagnosticSemaKinds.td | 3 ++- clang/test/Misc/warning-flags.c | 3 +-- clang/test/SemaObjC/method-lookup-3.m | 26 ++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index f684ce9..fec8ef1 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -274,6 +274,7 @@ def ObjCInvalidIBOutletProperty : DiagGroup<"invalid-iboutlet">; def ObjCRootClass : DiagGroup<"objc-root-class">; def ObjCPointerIntrospectPerformSelector : DiagGroup<"deprecated-objc-pointer-introspection-performSelector">; def ObjCPointerIntrospect : DiagGroup<"deprecated-objc-pointer-introspection", [ObjCPointerIntrospectPerformSelector]>; +def ObjCMultipleMethodName : DiagGroup<"objc-multiple-method-names">; def DeprecatedObjCIsaUsage : DiagGroup<"deprecated-objc-isa-usage">; def ExplicitInitializeCall : DiagGroup<"explicit-initialize-call">; def Packed : DiagGroup<"packed">; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 66306ec..a1b4b7d 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -721,7 +721,8 @@ def warn_implements_nscopying : Warning< "default assign attribute on property %0 which implements " "NSCopying protocol is not appropriate with -fobjc-gc[-only]">; -def warn_multiple_method_decl : Warning<"multiple methods named %0 found">; +def warn_multiple_method_decl : Warning<"multiple methods named %0 found">, + InGroup; def warn_strict_multiple_method_decl : Warning< "multiple methods named %0 found">, InGroup, DefaultIgnore; def warn_accessor_property_type_mismatch : Warning< diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c index 4e861b4..74ab566 100644 --- a/clang/test/Misc/warning-flags.c +++ b/clang/test/Misc/warning-flags.c @@ -18,7 +18,7 @@ This test serves two purposes: The list of warnings below should NEVER grow. It should gradually shrink to 0. -CHECK: Warnings without flags (97): +CHECK: Warnings without flags (96): CHECK-NEXT: ext_excess_initializers CHECK-NEXT: ext_excess_initializers_in_char_array_initializer CHECK-NEXT: ext_expected_semi_decl_list @@ -89,7 +89,6 @@ CHECK-NEXT: warn_missing_dependent_template_keyword CHECK-NEXT: warn_missing_exception_specification CHECK-NEXT: warn_missing_whitespace_after_macro_name CHECK-NEXT: warn_mt_message -CHECK-NEXT: warn_multiple_method_decl CHECK-NEXT: warn_no_constructor_for_refconst CHECK-NEXT: warn_not_compound_assign CHECK-NEXT: warn_objc_property_copy_missing_on_block diff --git a/clang/test/SemaObjC/method-lookup-3.m b/clang/test/SemaObjC/method-lookup-3.m index b3d9c46..ff2c489 100644 --- a/clang/test/SemaObjC/method-lookup-3.m +++ b/clang/test/SemaObjC/method-lookup-3.m @@ -71,3 +71,29 @@ struct test4b { float x, y; }; void test4(id x) { (void) [x test4]; //expected-warning {{multiple methods named 'test4' found}} } + +// rdar://19265296 +#pragma clang diagnostic ignored "-Wobjc-multiple-method-names" +@interface NSObject ++ (id)alloc; ++ (id)class; +- (id) init; +@end + +@class NSString; +@interface A : NSObject +- (instancetype)initWithType:(NSString *)whatever; +@end + +@interface Test : NSObject @end + +@implementation Test ++ (instancetype)foo +{ + return [[[self class] alloc] initWithType:3]; +} +- (instancetype)initWithType:(int)whatever +{ + return [super init]; +} +@end -- 2.7.4