Skip to content

Commit d12aee1

Browse files
committed
[clang-format] Don't break between string literal operands of <<
Fixes #44363.
1 parent ba468d4 commit d12aee1

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
@@ -26478,6 +26478,10 @@ TEST_F(FormatTest, PPBranchesInBracedInit) {
2647826478
"};");
2647926479
}
2648026480

26481+
TEST_F(FormatTest, StreamOutputOperator) {
26482+
verifyFormat("std::cout << \"foo\" << \"bar\" << baz;");
26483+
}
26484+
2648126485
} // namespace
2648226486
} // namespace test
2648326487
} // namespace format

0 commit comments

Comments
 (0)