[clang] [clang-format] Add KeepEmptyLines.AtEndOfBlock option (PR #224223)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 12:58:57 PDT 2026
================
@@ -25609,6 +25611,51 @@ TEST_F(FormatTest, KeepEmptyLinesAtEOF) {
verifyFormat(Code, "int i;\n\n\n", Style);
}
+TEST_F(FormatTest, KeepEmptyLinesAtStartOfBlock) {
+ FormatStyle Style = getLLVMStyle();
+ Style.AllowShortFunctionsOnASingleLine =
+ FormatStyle::ShortFunctionStyle::setEmptyAndInline();
+ Style.KeepEmptyLines.AtStartOfBlock = true;
+ Style.MaxEmptyLinesToKeep = 2;
+
+ verifyFormat("void foo() {\n"
+ "\n\n"
----------------
HazardyKnusperkeks wrote:
```suggestion
"\n"
"\n"
```
Break each line in the test code, it's easier to read.
https://github.com/llvm/llvm-project/pull/224223
More information about the cfe-commits
mailing list