[clang] [clang-format] Do not set AtStartOfBlock if not check by test case (PR #227680)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 05:06:31 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-format

Author: Arkadiusz Bokowy (arkq)

<details>
<summary>Changes</summary>

Setting `KeepEmptyLines.AtStartOfBlock` to `false` in the `RemovesEmptyLines` test case is misleading, because the check that follows does not verify this option. It does not matter whether it is set to `true` or `false`.

---
Full diff: https://github.com/llvm/llvm-project/pull/227680.diff


1 Files Affected:

- (modified) clang/unittests/Format/FormatTest.cpp (-2) 


``````````diff
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index bb630da34d7d9..3596ba62b1964 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -169,7 +169,6 @@ TEST_F(FormatTest, RemovesEmptyLines) {
   auto CustomStyle = getLLVMStyle();
   CustomStyle.BreakBeforeBraces = FormatStyle::BS_Custom;
   CustomStyle.BraceWrapping.AfterNamespace = true;
-  CustomStyle.KeepEmptyLines.AtStartOfBlock = false;
   verifyFormat("namespace N\n"
                "{\n"
                "\n"
@@ -396,7 +395,6 @@ TEST_F(FormatTest, RemovesEmptyLines) {
   Style.BreakBeforeBraces = FormatStyle::BS_Custom;
   Style.BraceWrapping.AfterClass = true;
   Style.BraceWrapping.AfterFunction = true;
-  Style.KeepEmptyLines.AtStartOfBlock = false;
 
   verifyFormat("class Foo\n"
                "{\n"

``````````

</details>


https://github.com/llvm/llvm-project/pull/227680


More information about the cfe-commits mailing list