Skip to content

Commit d68826d

Browse files
authored
[clang-format] Don't break between string literal operands of << (#69871)
Fixes #44363.
1 parent 2325b3c commit d68826d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5117,10 +5117,6 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
51175117
return true;
51185118
if (Left.IsUnterminatedLiteral)
51195119
return true;
5120-
if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
5121-
Right.Next->is(tok::string_literal)) {
5122-
return true;
5123-
}
51245120
if (Right.is(TT_RequiresClause)) {
51255121
switch (Style.RequiresClausePosition) {
51265122
case FormatStyle::RCPS_OwnLine:

clang/unittests/Format/FormatTest.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26468,6 +26468,10 @@ TEST_F(FormatTest, PPBranchesInBracedInit) {
2646826468
"};");
2646926469
}
2647026470

26471+
TEST_F(FormatTest, StreamOutputOperator) {
26472+
verifyFormat("std::cout << \"foo\" << \"bar\" << baz;");
26473+
}
26474+
2647126475
} // namespace
2647226476
} // namespace test
2647326477
} // namespace format

0 commit comments

Comments
 (0)