clang-format: Remove empty lines at the beginning of blocks.
They very rarely aid readability.
Formatting:
void f() {
if (a) {
f();
}
}
Now leads to:
void f() {
if (a) {
f();
}
}
llvm-svn: 204460
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index e1b72d9..42b9e85 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -174,6 +174,22 @@
"\n"
"};"));
+ // Remove empty lines at the beginning and end of blocks.
+ EXPECT_EQ("void f() {\n"
+ " if (a) {\n"
+ " f();\n"
+ " }\n"
+ "}",
+ format("void f() {\n"
+ "\n"
+ " if (a) {\n"
+ "\n"
+ " f();\n"
+ "\n"
+ " }\n"
+ "\n"
+ "}"));
+
// Don't remove empty lines in more complex control statements.
EXPECT_EQ("void f() {\n"
" if (a) {\n"