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

Eric Li via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 4 08:39:20 PDT 2025


================
@@ -986,7 +986,7 @@ class LineJoiner {
   void join(AnnotatedLine &A, const AnnotatedLine &B) {
     assert(!A.Last->Next);
     assert(!B.First->Previous);
-    if (B.Affected)
+    if (B.Affected || (B.LeadingEmptyLinesAffected && A.Last->Children.empty()))
----------------
tJener wrote:

I'm not familiar with when the current implementation would merge two lines where `!A.Last->Children.empty()`. Do you have any suggestions?

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


More information about the cfe-commits mailing list