Index: lib/Format/ContinuationIndenter.cpp =================================================================== --- lib/Format/ContinuationIndenter.cpp +++ lib/Format/ContinuationIndenter.cpp @@ -919,6 +919,12 @@ NewParenState.NoLineBreak = NewParenState.NoLineBreak || State.Stack.back().NoLineBreakInOperand; + // Don't propagate AvoidBinPacking into subexpressions of arg/param lists. + if (Current.FakeLParens.size() > 0 && + Current.FakeLParens.back() > prec::Comma) { + NewParenState.AvoidBinPacking = false; + } + // Indent from 'LastSpace' unless these are fake parentheses encapsulating // a builder type call after 'return' or, if the alignment after opening // brackets is disabled. Index: unittests/Format/FormatTest.cpp =================================================================== --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -2591,6 +2591,30 @@ Style); } +TEST_F(FormatTest, AllowBinPackingInsideArguments) { + FormatStyle Style = getLLVMStyle(); + Style.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak; + Style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment; + Style.BinPackArguments = false; + Style.BinPackParameters = false; + verifyFormat(StringRef(R"( +someFunction( + arg1, + arg2, + arg3____________________________ + is + quite + long + so + it + + f(and_even, + the, + arguments << of << its << subexpressions << lengthy << as << they + << may << or__ << may, + not__, + be) + + a + r + e / l + o + v + i + n + g + l + y / b + i + n - p + a + c + k + + e + d, + arg4, + arg5); + )").trim(), Style); +} + TEST_F(FormatTest, ConstructorInitializers) { verifyFormat("Constructor() : Initializer(FitsOnTheLine) {}"); verifyFormat("Constructor() : Inttializer(FitsOnTheLine) {}",