r370688 - Split -Wreorder into different warnings for reordering a constructor

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 2 16:17:32 PDT 2019


Author: rsmith
Date: Mon Sep  2 16:17:32 2019
New Revision: 370688

URL: http://llvm.org/viewvc/llvm-project?rev=370688&view=rev
Log:
Split -Wreorder into different warnings for reordering a constructor
mem-initializer list and for reordering a designated initializer list.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticGroups.td
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/test/SemaCXX/cxx2a-initializer-aggregates.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=370688&r1=370687&r2=370688&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Sep  2 16:17:32 2019
@@ -632,7 +632,9 @@ def UnusedGetterReturnValue : DiagGroup<
 def UsedButMarkedUnused : DiagGroup<"used-but-marked-unused">;
 def UserDefinedLiterals : DiagGroup<"user-defined-literals">;
 def UserDefinedWarnings : DiagGroup<"user-defined-warnings">;
-def Reorder : DiagGroup<"reorder">;
+def ReorderCtor : DiagGroup<"reorder-ctor">;
+def ReorderInitList : DiagGroup<"reorder-init-list">;
+def Reorder : DiagGroup<"reorder", [ReorderCtor, ReorderInitList]>;
 def UndeclaredSelector : DiagGroup<"undeclared-selector">;
 def ImplicitAtomic : DiagGroup<"implicit-atomic-properties">;
 def CustomAtomic : DiagGroup<"custom-atomic-properties">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=370688&r1=370687&r2=370688&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Sep  2 16:17:32 2019
@@ -208,7 +208,7 @@ def ext_designated_init_nested : ExtWarn
   "nested designators are a C99 extension">, InGroup<C99Designator>;
 def ext_designated_init_reordered : ExtWarn<
   "ISO C++ requires field designators to be specified in declaration order; "
-  "field %1 will be initialized after field %0">, InGroup<Reorder>,
+  "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
   SFINAEFailure;
 def note_previous_field_init : Note<
   "previous initialization for field %0 is here">;
@@ -7644,7 +7644,7 @@ def err_mem_init_not_member_or_class : E
 def warn_initializer_out_of_order : Warning<
   "%select{field|base class}0 %1 will be initialized after "
   "%select{field|base}2 %3">,
-  InGroup<Reorder>, DefaultIgnore;
+  InGroup<ReorderCtor>, DefaultIgnore;
 def warn_abstract_vbase_init_ignored : Warning<
   "initializer for virtual base class %0 of abstract class %1 "
   "will never be used">,

Modified: cfe/trunk/test/SemaCXX/cxx2a-initializer-aggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx2a-initializer-aggregates.cpp?rev=370688&r1=370687&r2=370688&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx2a-initializer-aggregates.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx2a-initializer-aggregates.cpp Mon Sep  2 16:17:32 2019
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -std=c++2a %s -verify=expected,pedantic,override,reorder -pedantic-errors
-// RUN: %clang_cc1 -std=c++2a %s -verify=expected,pedantic -Werror=c99-designator -Wno-reorder -Wno-initializer-overrides
-// RUN: %clang_cc1 -std=c++2a %s -verify=expected,reorder -Wno-c99-designator -Werror=reorder -Wno-initializer-overrides
-// RUN: %clang_cc1 -std=c++2a %s -verify=expected,override -Wno-c99-designator -Wno-reorder -Werror=initializer-overrides
-// RUN: %clang_cc1 -std=c++2a %s -verify -Wno-c99-designator -Wno-reorder -Wno-initializer-overrides
+// RUN: %clang_cc1 -std=c++2a %s -verify=expected,pedantic -Werror=c99-designator -Wno-reorder-init-list -Wno-initializer-overrides
+// RUN: %clang_cc1 -std=c++2a %s -verify=expected,reorder -Wno-c99-designator -Werror=reorder-init-list -Wno-initializer-overrides
+// RUN: %clang_cc1 -std=c++2a %s -verify=expected,override -Wno-c99-designator -Wno-reorder-init-list -Werror=initializer-overrides
+// RUN: %clang_cc1 -std=c++2a %s -verify -Wno-c99-designator -Wno-reorder-init-list -Wno-initializer-overrides
 
 
 namespace class_with_ctor {




More information about the cfe-commits mailing list