diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -346,8 +346,12 @@ // Continued function call if (ScopeStart > Start + 1 && Changes[ScopeStart - 2].Tok->is(tok::identifier) && - Changes[ScopeStart - 1].Tok->is(tok::l_paren)) + Changes[ScopeStart - 1].Tok->is(tok::l_paren)) { + if (Changes[i].Tok->MatchingParen && + Changes[i].Tok->MatchingParen->is(TT_LambdaLBrace)) + return false; return Style.BinPackArguments; + } // Ternary operator if (Changes[i].Tok->is(TT_ConditionalExpr)) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -16110,6 +16110,13 @@ "int yy = 1; ///specificlennospace\n" "int zzz = 2;\n", Alignment)); + + Alignment.AllowShortLambdasOnASingleLine = FormatStyle::SLS_None; + verifyFormat("auto aaaaaaaaaaaaaaaaaaaaa = {};\n" + "auto b = g([] {\n" + " return;\n" + "});", + Alignment); } TEST_F(FormatTest, AlignConsecutiveBitFields) {