Objective-C. Provide group name for warning

on multiple selector names found during lookup.
rdar://19265296


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224536 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2014-12-18 19:41:11 +00:00
parent ecc159aae7
commit 56a9429da1
4 changed files with 30 additions and 3 deletions

View File

@ -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">;

View File

@ -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<ObjCMultipleMethodName>;
def warn_strict_multiple_method_decl : Warning<
"multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
def warn_accessor_property_type_mismatch : Warning<

View File

@ -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

View File

@ -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