================ @@ -768,15 +768,25 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, // parenthesis by disallowing any further line breaks if there is no line // break after the opening parenthesis. Don't break if it doesn't conserve // columns. + const auto IsOpeningBracket = [&](const FormatToken &Tok) { + const auto IsStartOfBracedList = [&]() { + return Tok.is(tok::l_brace) && Tok.isNot(BK_Block) && + Style.Cpp11BracedListStyle; + }; + if (Tok.isOneOf(tok::l_paren, TT_TemplateOpener, tok::l_square) || + IsStartOfBracedList()) { + if (!Tok.Previous) + return true; + if (Tok.Previous->isIf()) + return Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak; + return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, + tok::kw_switch); + } + return false; ---------------- owenca wrote:
```suggestion if (!Tok.isOneOf(tok::l_paren, TT_TemplateOpener, tok::l_square) && !IsStartOfBracedList()) { return false; } if (!Tok.Previous) return true; if (Tok.Previous->isIf()) return Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak; return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); ``` https://github.com/llvm/llvm-project/pull/77699 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits