Index: lib/Format/ContinuationIndenter.cpp =================================================================== --- lib/Format/ContinuationIndenter.cpp +++ lib/Format/ContinuationIndenter.cpp @@ -136,8 +136,12 @@ } // If binary operators are moved to the next line (including commas for some - // styles of constructor initializers), that's always ok. - if (!Current.isOneOf(TT_BinaryOperator, tok::comma) && + // styles of constructor initializers), that's always ok. Also the second + // element in a sequence of two consecutive string literals is ok to be + // moved to the next line. + if (!(Current.isOneOf(TT_BinaryOperator, tok::comma) || + (Current.is(tok::string_literal) && + Previous.is(tok::string_literal))) && State.Stack.back().NoLineBreakInOperand) return false; Index: unittests/Format/FormatTest.cpp =================================================================== --- unittests/Format/FormatTest.cpp +++ unittests/Format/FormatTest.cpp @@ -4141,6 +4141,14 @@ " << \"qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq\";\n" "}"); + // The second of two consecutive string literals can be put on a newline. + EXPECT_EQ("long_long_long_long\n" + " << long_long_long_long << \"long lo\"\n" + " \"ng\"", + format("long_long_long_long\n" + " << long_long_long_long << \"long lo\"\n" + " \"ng\"", + getLLVMStyleWithColumns(40))); // Handle 'endl'. verifyFormat("llvm::errs() << aaaaaaaaaaaaaaaaaaaaaa << endl\n" " << bbbbbbbbbbbbbbbbbbbbbb << endl;");