Skip to content

Commit

Permalink
[clang-format] Don't break between string literal operands of << (llv…
Browse files Browse the repository at this point in the history
  • Loading branch information
owenca authored Oct 24, 2023
1 parent 2325b3c commit d68826d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions clang/unittests/Format/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26468,6 +26468,10 @@ TEST_F(FormatTest, PPBranchesInBracedInit) {
"};");
}

TEST_F(FormatTest, StreamOutputOperator) {
verifyFormat("std::cout << \"foo\" << \"bar\" << baz;");
}

} // namespace
} // namespace test
} // namespace format
Expand Down

0 comments on commit d68826d

Please sign in to comment.