Index: clang/lib/Format/ContinuationIndenter.cpp =================================================================== --- clang/lib/Format/ContinuationIndenter.cpp +++ clang/lib/Format/ContinuationIndenter.cpp @@ -809,8 +809,10 @@ // Indent relative to the RHS of the expression unless this is a simple // assignment without binary expression on the RHS. Also indent relative to // unary operators and the colons of constructor initializers. - if (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None) + if (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None || + Style.BreakBeforeBinaryOperators == FormatStyle::BOS_NonAssignment) { CurrentState.LastSpace = State.Column; + } } else if (Previous.is(TT_InheritanceColon)) { CurrentState.Indent = State.Column; CurrentState.LastSpace = State.Column; Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -6594,6 +6594,32 @@ "(someOtherLongishConditionPart1 || " "someOtherEvenLongerNestedConditionPart2);", Style)); + + Style = getLLVMStyle(); + Style.AlignAfterOpenBracket = FormatStyle::BAS_AlwaysBreak; + Style.BinPackParameters = false; + Style.ContinuationIndentWidth = 2; + Style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment; + EXPECT_EQ( + "struct Derived {\n" + " Derived(\n" + " int firstArgWithLongName,\n" + " int secondArgWithLongName,\n" + " int thirdArgWithLongName,\n" + " int fourthArgWithLongName)\n" + " : Base(\n" + " firstArgWithLongName,\n" + " secondArgWithLongName,\n" + " thirdArgWithLongName,\n" + " fourthArgWithLongName) {}\n" + "};", + format("struct Derived {" + " Derived(int firstArgWithLongName, int secondArgWithLongName, " + "int thirdArgWithLongName, int fourthArgWithLongName)" + " : Base(firstArgWithLongName, secondArgWithLongName, " + "thirdArgWithLongName, fourthArgWithLongName) {}" + "};", + Style)); } TEST_F(FormatTest, ExpressionIndentationStrictAlign) {