https://github.com/s1Sharp updated 
https://github.com/llvm/llvm-project/pull/69859

>From a5c62614113b4c42e9051905bb6165331192ded0 Mon Sep 17 00:00:00 2001
From: Tsarkov Maksim <mtsar...@naumen.ru>
Date: Sun, 22 Oct 2023 02:09:21 +0300
Subject: [PATCH] [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 https://github.com/llvm/llvm-project/issues/59797
Fixes https://github.com/llvm/llvm-project/issues/44363
---
 clang/lib/Format/TokenAnnotator.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index a457ced9f886846..fea5b809824d3e3 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5118,7 +5118,9 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine 
&Line,
   if (Left.IsUnterminatedLiteral)
     return true;
   if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
-      Right.Next->is(tok::string_literal)) {
+      Right.Next->is(tok::string_literal) &&
+      (Style.BreakBeforeBinaryOperators == FormatStyle::BOS_All ||
+       Style.BreakBeforeBinaryOperators == FormatStyle::BOS_NonAssignment)) {
     return true;
   }
   if (Right.is(TT_RequiresClause)) {

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to