================ @@ -510,27 +515,50 @@ class LineJoiner { // Try to merge a function block with left brace wrapped. if (NextLine.First->is(TT_FunctionLBrace) && - Style.BraceWrapping.AfterFunction) { + (Style.BraceWrapping.AfterFunction || + Style.AllowShortBlocksOnASingleLine >= FormatStyle::SBS_Empty)) { if (NextLine.Last->is(TT_LineComment)) return 0; // Check for Limit <= 2 to account for the " {". if (Limit <= 2 || (Style.ColumnLimit == 0 && containsMustBreak(TheLine))) - return 0; + if (Style.BraceWrapping.AfterFunction) + return 0; Limit -= 2; unsigned MergedLines = 0; + const bool NextShortBlock = NextLine.First == NextLine.Last && + I + 3 != E && I[3]->First->is(tok::r_brace); ---------------- brandb97 wrote:
I didn't quite understand why the LLDB formatter failed. Could you help me analyze the possible reasons for the error? Thank you very much! https://github.com/llvm/llvm-project/pull/151428 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits