Skip to content

Commit

Permalink
[clang-format] Add SortPriority fields to fix -Wmissing-field-initial…
Browse files Browse the repository at this point in the history
…izers after D64695/r372919

llvm-svn: 372939
  • Loading branch information
MaskRay committed Sep 26, 2019
1 parent f57e968 commit f045828
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -818,8 +818,10 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
GoogleStyle.AlwaysBreakTemplateDeclarations = FormatStyle::BTDS_Yes;
GoogleStyle.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
GoogleStyle.DerivePointerAlignment = true;
GoogleStyle.IncludeStyle.IncludeCategories = {
{"^<ext/.*\\.h>", 2}, {"^<.*\\.h>", 1}, {"^<.*", 2}, {".*", 3}};
GoogleStyle.IncludeStyle.IncludeCategories = {{"^<ext/.*\\.h>", 2, 0},
{"^<.*\\.h>", 1, 0},
{"^<.*", 2, 0},
{".*", 3, 0}};
GoogleStyle.IncludeStyle.IncludeIsMainRegex = "([-_](test|unittest))?$";
GoogleStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup;
GoogleStyle.IndentCaseLabels = true;
Expand Down
2 changes: 1 addition & 1 deletion clang/unittests/Format/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12463,7 +12463,7 @@ TEST_F(FormatTest, ParsesConfiguration) {

Style.IncludeStyle.IncludeCategories.clear();
std::vector<tooling::IncludeStyle::IncludeCategory> ExpectedCategories = {
{"abc/.*", 2}, {".*", 1}};
{"abc/.*", 2, 0}, {".*", 1, 0}};
CHECK_PARSE("IncludeCategories:\n"
" - Regex: abc/.*\n"
" Priority: 2\n"
Expand Down

0 comments on commit f045828

Please sign in to comment.