[clang] [clang-format] Propagate `LeadingEmptyLinesAffected` when joining lines (PR #146761)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 4 01:18:54 PDT 2025


================
@@ -41,6 +41,8 @@ TEST_F(FormatTestSelective, RemovesTrailingWhitespaceOfFormattedLine) {
   EXPECT_EQ("int a;", format("int a;         ", 0, 0));
   EXPECT_EQ("int a;\n", format("int a;  \n   \n   \n ", 0, 0));
   EXPECT_EQ("int a;\nint b;    ", format("int a;  \nint b;    ", 0, 0));
+
+  EXPECT_EQ("void f() {}\n", format("void f() {\n  \n}\n", 11, 0));
----------------
owenca wrote:

```suggestion
  EXPECT_EQ("void f() {}", format("void f() {\n"
                                  "  \n"
                                  "}",
                                  11, 0));
```

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


More information about the cfe-commits mailing list