Skip to content

Commit 5bbff07

Browse files
author
Tsarkov Maksim
committed
[clang-format] unexpected break after binOp '<<'
the problem occurred while checking for the correctness of the break after binary operators. The output statement 'tok::lessless' is then break line every possible time, which is not expected with the BreakBeforeBinaryOperators: None Fixes #59797 Fixes #44363
1 parent 01ea528 commit 5bbff07

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/Format/TokenAnnotator.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5119,7 +5119,9 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
51195119
if (Left.IsUnterminatedLiteral)
51205120
return true;
51215121
if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
5122-
Right.Next->is(tok::string_literal)) {
5122+
Right.Next->is(tok::string_literal) &&
5123+
(Style.BreakBeforeBinaryOperators == FormatStyle::BOS_All ||
5124+
Style.BreakBeforeBinaryOperators == FormatStyle::BOS_NonAssignment)) {
51235125
return true;
51245126
}
51255127
if (Right.is(TT_RequiresClause)) {

0 commit comments

Comments
 (0)