diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 7f5730615944..cf6373f45657 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2001,7 +2001,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, if (Left.isOneOf(tok::plus, tok::comma) && Left.Previous && Left.Previous->isLabelString() && (Left.NextOperator || Left.OperatorIndex != 0)) - return 100; + return 45; if (Right.is(tok::plus) && Left.isLabelString() && (Right.NextOperator || Right.OperatorIndex != 0)) return 25; diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 09b85357d152..6f9df680eef5 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5220,6 +5220,10 @@ TEST_F(FormatTest, KeepStringLabelValuePairsOnALine) { verifyFormat("string v = StrCat(\"aaaaaaaaaaaa: \" +\n" " (aaaaaaa + aaaaa));", getLLVMStyleWithColumns(40)); + verifyFormat( + "string v = StrCat(\"aaaaaaaaaaaaaaaaaaaaaaaaaaa: \",\n" + " SomeFunction(aaaaaaaaaaaa, aaaaaaaa.aaaaaaa),\n" + " bbbbbbbbbbbbbbbbbbbbbbb);"); } TEST_F(FormatTest, UnderstandsEquals) {