summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/Format.cpp1
-rw-r--r--clang/unittests/Format/CleanupTest.cpp2
-rw-r--r--clang/unittests/Format/SortIncludesTest.cpp16
3 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 119be9fae67..4dee599fe01 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -784,6 +784,7 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) {
GoogleStyle.IncludeStyle.IncludeCategories = {
{"^<ext/.*\\.h>", 2}, {"^<.*\\.h>", 1}, {"^<.*", 2}, {".*", 3}};
GoogleStyle.IncludeStyle.IncludeIsMainRegex = "([-_](test|unittest))?$";
+ GoogleStyle.IncludeStyle.IncludeBlocks = tooling::IncludeStyle::IBS_Regroup;
GoogleStyle.IndentCaseLabels = true;
GoogleStyle.KeepEmptyLinesAtTheStartOfBlocks = false;
GoogleStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Never;
diff --git a/clang/unittests/Format/CleanupTest.cpp b/clang/unittests/Format/CleanupTest.cpp
index 6afa56ec10a..0628c38a2bd 100644
--- a/clang/unittests/Format/CleanupTest.cpp
+++ b/clang/unittests/Format/CleanupTest.cpp
@@ -420,8 +420,10 @@ TEST_F(CleanUpReplacementsTest, InsertMultipleNewHeadersAndSortLLVM) {
TEST_F(CleanUpReplacementsTest, InsertMultipleNewHeadersAndSortGoogle) {
std::string Code = "\nint x;";
std::string Expected = "\n#include \"fix.h\"\n"
+ "\n"
"#include <list>\n"
"#include <vector>\n"
+ "\n"
"#include \"a.h\"\n"
"#include \"b.h\"\n"
"#include \"c.h\"\n"
diff --git a/clang/unittests/Format/SortIncludesTest.cpp b/clang/unittests/Format/SortIncludesTest.cpp
index 75f4156f3d8..836d4c366cc 100644
--- a/clang/unittests/Format/SortIncludesTest.cpp
+++ b/clang/unittests/Format/SortIncludesTest.cpp
@@ -262,9 +262,13 @@ TEST_F(SortIncludesTest, CommentsAlwaysSeparateGroups) {
TEST_F(SortIncludesTest, HandlesAngledIncludesAsSeparateBlocks) {
EXPECT_EQ("#include \"a.h\"\n"
"#include \"c.h\"\n"
+ "#include <array>\n"
"#include <b.h>\n"
- "#include <d.h>\n",
- sort("#include <d.h>\n"
+ "#include <d.h>\n"
+ "#include <vector>\n",
+ sort("#include <vector>\n"
+ "#include <d.h>\n"
+ "#include <array>\n"
"#include <b.h>\n"
"#include \"c.h\"\n"
"#include \"a.h\"\n"));
@@ -272,9 +276,15 @@ TEST_F(SortIncludesTest, HandlesAngledIncludesAsSeparateBlocks) {
FmtStyle = getGoogleStyle(FormatStyle::LK_Cpp);
EXPECT_EQ("#include <b.h>\n"
"#include <d.h>\n"
+ "\n"
+ "#include <array>\n"
+ "#include <vector>\n"
+ "\n"
"#include \"a.h\"\n"
"#include \"c.h\"\n",
- sort("#include <d.h>\n"
+ sort("#include <vector>\n"
+ "#include <d.h>\n"
+ "#include <array>\n"
"#include <b.h>\n"
"#include \"c.h\"\n"
"#include \"a.h\"\n"));
OpenPOWER on IntegriCloud