[PATCH] D60263: [clang-format] Preserve include blocks in ObjC Google style
Krasimir Georgiev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 4 07:02:37 PDT 2019
krasimir updated this revision to Diff 193699.
krasimir added a comment.
- Add a note about intent
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60263/new/
https://reviews.llvm.org/D60263
Files:
lib/Format/Format.cpp
unittests/Format/SortIncludesTest.cpp
Index: unittests/Format/SortIncludesTest.cpp
===================================================================
--- unittests/Format/SortIncludesTest.cpp
+++ unittests/Format/SortIncludesTest.cpp
@@ -653,6 +653,18 @@
EXPECT_EQ(Code, sort(Code, "input.h", 0));
}
+
+TEST_F(SortIncludesTest, DoNotRegroupGroupsInGoogleObjCStyle) {
+ FmtStyle = getGoogleStyle(FormatStyle::LK_ObjC);
+
+ EXPECT_EQ("#include <a.h>\n"
+ "#include <b.h>\n"
+ "#include \"a.h\"",
+ sort("#include <b.h>\n"
+ "#include <a.h>\n"
+ "#include \"a.h\""));
+}
+
} // end namespace
} // end namespace format
} // end namespace clang
Index: lib/Format/Format.cpp
===================================================================
--- lib/Format/Format.cpp
+++ lib/Format/Format.cpp
@@ -877,6 +877,11 @@
} else if (Language == FormatStyle::LK_ObjC) {
GoogleStyle.AlwaysBreakBeforeMultilineStrings = false;
GoogleStyle.ColumnLimit = 100;
+ // "Regroup" doesn't work well for ObjC yet (main header heuristic,
+ // relationship between ObjC standard library headers and other heades,
+ // #imports, etc.)
+ GoogleStyle.IncludeStyle.IncludeBlocks =
+ tooling::IncludeStyle::IBS_Preserve;
}
return GoogleStyle;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60263.193699.patch
Type: text/x-patch
Size: 1291 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190404/de8aca1c/attachment.bin>
More information about the cfe-commits
mailing list