[clang-format] Don't break between string literal operands of << (#69871)

Fixes #44363.
This commit is contained in:
Owen Pan
2023-10-24 02:42:39 -07:00
committed by GitHub
parent 2325b3cfda
commit d68826dfbd
2 changed files with 4 additions and 4 deletions

View File

@@ -5117,10 +5117,6 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
return true;
if (Left.IsUnterminatedLiteral)
return true;
if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
Right.Next->is(tok::string_literal)) {
return true;
}
if (Right.is(TT_RequiresClause)) {
switch (Style.RequiresClausePosition) {
case FormatStyle::RCPS_OwnLine:

View File

@@ -26468,6 +26468,10 @@ TEST_F(FormatTest, PPBranchesInBracedInit) {
"};");
}
TEST_F(FormatTest, StreamOutputOperator) {
verifyFormat("std::cout << \"foo\" << \"bar\" << baz;");
}
} // namespace
} // namespace test
} // namespace format