From 4b74975b0acd29f2260b60feb13f801f83d15c5e Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 26 Sep 2019 02:02:17 +0000 Subject: [PATCH] [clang-format] Add SortPriority fields to fix -Wmissing-field-initializers after D64695/r372919 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372939 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/Format.cpp | 12 +++++++----- unittests/Format/FormatTest.cpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index b64d482524..07fdcc83af 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -734,9 +734,9 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { LLVMStyle.ForEachMacros.push_back("Q_FOREACH"); LLVMStyle.ForEachMacros.push_back("BOOST_FOREACH"); LLVMStyle.IncludeStyle.IncludeCategories = { - {"^\"(llvm|llvm-c|clang|clang-c)/", 2}, - {"^(<|\"(gtest|gmock|isl|json)/)", 3}, - {".*", 1}}; + {"^\"(llvm|llvm-c|clang|clang-c)/", 2, 0}, + {"^(<|\"(gtest|gmock|isl|json)/)", 3, 0}, + {".*", 1, 0}}; LLVMStyle.IncludeStyle.IncludeIsMainRegex = "(Test)?$"; LLVMStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Preserve; LLVMStyle.IndentCaseLabels = false; @@ -818,8 +818,10 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { GoogleStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes; GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true; GoogleStyle.DerivePointerAlignment = true; - GoogleStyle.IncludeStyle.IncludeCategories = { - {"^", 2}, {"^<.*\\.h>", 1}, {"^<.*", 2}, {".*", 3}}; + GoogleStyle.IncludeStyle.IncludeCategories = {{"^", 2, 0}, + {"^<.*\\.h>", 1, 0}, + {"^<.*", 2, 0}, + {".*", 3, 0}}; GoogleStyle.IncludeStyle.IncludeIsMainRegex = "([-_](test|unittest))?$"; GoogleStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup; GoogleStyle.IndentCaseLabels = true; diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 94eab1a6af..581d15672b 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -12463,7 +12463,7 @@ TEST_F(FormatTest, ParsesConfiguration) { Style.IncludeStyle.IncludeCategories.clear(); std::vector ExpectedCategories = { - {"abc/.*", 2}, {".*", 1}}; + {"abc/.*", 2, 0}, {".*", 1, 0}}; CHECK_PARSE("IncludeCategories:\n" " - Regex: abc/.*\n" " Priority: 2\n" -- 2.40.0