ahatanak created this revision.
ahatanak added reviewers: Bigcheese, vsapsai.
ahatanak added a project: clang.
Herald added a project: All.
ahatanak requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154251

Files:
  clang/include/clang/Basic/DiagnosticCommonKinds.td
  clang/test/SemaObjC/check-dup-objc-decls-1.m


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===================================================================
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ clang/test/SemaObjC/check-dup-objc-decls-1.m
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class 
-Wno-objc-duplicate-category-definition -DIGNORE_DUP_CAT %s
 
 @interface Foo // expected-note {{previous definition is here}}
 @end
@@ -41,8 +42,13 @@
 @protocol DP<Q> @end
 #pragma clang diagnostic pop
 
-@interface A(Cat)<P> @end // expected-note {{previous definition is here}}
-@interface A(Cat)<Q> @end // expected-warning {{duplicate definition of 
category 'Cat' on interface 'A'}}
+@interface A(Cat)<P> @end
+@interface A(Cat)<Q> @end
+
+#ifndef IGNORE_DUP_CAT
+// expected-note@-4 {{previous definition is here}}
+// expected-warning@-4 {{duplicate definition of category 'Cat' on interface 
'A'}}
+#endif
 
 // rdar 7626768
 @class NSString;
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // Sema && Serialization
 def warn_dup_category_def : Warning<
-  "duplicate definition of category %1 on interface %0">;
+  "duplicate definition of category %1 on interface %0">,
+  InGroup<DiagGroup<"objc-duplicate-category-definition">>;
 
 // Targets
 


Index: clang/test/SemaObjC/check-dup-objc-decls-1.m
===================================================================
--- clang/test/SemaObjC/check-dup-objc-decls-1.m
+++ clang/test/SemaObjC/check-dup-objc-decls-1.m
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class -Wno-objc-duplicate-category-definition -DIGNORE_DUP_CAT %s
 
 @interface Foo // expected-note {{previous definition is here}}
 @end
@@ -41,8 +42,13 @@
 @protocol DP<Q> @end
 #pragma clang diagnostic pop
 
-@interface A(Cat)<P> @end // expected-note {{previous definition is here}}
-@interface A(Cat)<Q> @end // expected-warning {{duplicate definition of category 'Cat' on interface 'A'}}
+@interface A(Cat)<P> @end
+@interface A(Cat)<Q> @end
+
+#ifndef IGNORE_DUP_CAT
+// expected-note@-4 {{previous definition is here}}
+// expected-warning@-4 {{duplicate definition of category 'Cat' on interface 'A'}}
+#endif
 
 // rdar 7626768
 @class NSString;
Index: clang/include/clang/Basic/DiagnosticCommonKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -305,7 +305,8 @@
 
 // Sema && Serialization
 def warn_dup_category_def : Warning<
-  "duplicate definition of category %1 on interface %0">;
+  "duplicate definition of category %1 on interface %0">,
+  InGroup<DiagGroup<"objc-duplicate-category-definition">>;
 
 // Targets
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to