r224536 - Objective-C. Provide group name for warning
Fariborz Jahanian
fjahanian at apple.com
Thu Dec 18 11:41:12 PST 2014
Author: fjahanian
Date: Thu Dec 18 13:41:11 2014
New Revision: 224536
URL: http://llvm.org/viewvc/llvm-project?rev=224536&view=rev
Log:
Objective-C. Provide group name for warning
on multiple selector names found during lookup.
rdar://19265296
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/test/Misc/warning-flags.c
cfe/trunk/test/SemaObjC/method-lookup-3.m
Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=224536&r1=224535&r2=224536&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Thu Dec 18 13:41:11 2014
@@ -274,6 +274,7 @@ def ObjCInvalidIBOutletProperty : DiagGr
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">;
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=224536&r1=224535&r2=224536&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Dec 18 13:41:11 2014
@@ -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<
Modified: cfe/trunk/test/Misc/warning-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=224536&r1=224535&r2=224536&view=diff
==============================================================================
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Thu Dec 18 13:41:11 2014
@@ -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_tem
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
Modified: cfe/trunk/test/SemaObjC/method-lookup-3.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/method-lookup-3.m?rev=224536&r1=224535&r2=224536&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/method-lookup-3.m (original)
+++ cfe/trunk/test/SemaObjC/method-lookup-3.m Thu Dec 18 13:41:11 2014
@@ -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"
+ at interface NSObject
++ (id)alloc;
++ (id)class;
+- (id) init;
+ at end
+
+ at class NSString;
+ at interface A : NSObject
+- (instancetype)initWithType:(NSString *)whatever;
+ at end
+
+ at interface Test : NSObject @end
+
+ at implementation Test
++ (instancetype)foo
+{
+ return [[[self class] alloc] initWithType:3];
+}
+- (instancetype)initWithType:(int)whatever
+{
+ return [super init];
+}
+ at end
More information about the cfe-commits
mailing list