From 525410b105551854f35458f23c7ba3eba12d0fcc Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 2 Sep 2019 23:17:32 +0000 Subject: [PATCH] Split -Wreorder into different warnings for reordering a constructor mem-initializer list and for reordering a designated initializer list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370688 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/DiagnosticGroups.td | 4 +++- include/clang/Basic/DiagnosticSemaKinds.td | 4 ++-- test/SemaCXX/cxx2a-initializer-aggregates.cpp | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/clang/Basic/DiagnosticGroups.td b/include/clang/Basic/DiagnosticGroups.td index 45e34df4d5..aa1773481d 100644 --- a/include/clang/Basic/DiagnosticGroups.td +++ b/include/clang/Basic/DiagnosticGroups.td @@ -632,7 +632,9 @@ def UnusedGetterReturnValue : DiagGroup<"unused-getter-return-value">; 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">; diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 93be2cd476..80f9439c20 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -208,7 +208,7 @@ def ext_designated_init_nested : ExtWarn< "nested designators are a C99 extension">, InGroup; 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, + "field %1 will be initialized after field %0">, InGroup, 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 : Error< def warn_initializer_out_of_order : Warning< "%select{field|base class}0 %1 will be initialized after " "%select{field|base}2 %3">, - InGroup, DefaultIgnore; + InGroup, DefaultIgnore; def warn_abstract_vbase_init_ignored : Warning< "initializer for virtual base class %0 of abstract class %1 " "will never be used">, diff --git a/test/SemaCXX/cxx2a-initializer-aggregates.cpp b/test/SemaCXX/cxx2a-initializer-aggregates.cpp index a974f3d726..c24c53e562 100644 --- a/test/SemaCXX/cxx2a-initializer-aggregates.cpp +++ b/test/SemaCXX/cxx2a-initializer-aggregates.cpp @@ -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 { -- 2.40.0