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

Arkadiusz Bokowy via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 30 05:05:34 PDT 2026


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

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`.

>From bfd514506ab564d77aa9a1ab8b3452959871b3bc Mon Sep 17 00:00:00 2001
From: Arkadiusz Bokowy <arkadiusz.bokowy at gmail.com>
Date: Wed, 30 Sep 2026 10:17:09 +0200
Subject: [PATCH] [clang-format] Do not set AtStartOfBlock if not check by test
 case

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.
---
 clang/unittests/Format/FormatTest.cpp | 2 --
 1 file changed, 2 deletions(-)

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"



More information about the cfe-commits mailing list