================
@@ -5151,6 +5151,14 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine 
&Line,
     return true;
   if (Left.IsUnterminatedLiteral)
     return true;
+  // FIXME: Breaking after newlines seems useful in general. Turn this into an
+  // option and recognize more cases like endl etc, and break independent of
+  // what comes after operator lessless.
+  if (Right.is(tok::lessless) && Right.Next &&
+      Right.Next->is(tok::string_literal) && Left.is(tok::string_literal) &&
+      Left.TokenText.ends_with("\\n\"")) {
----------------
owenca wrote:

We can also handle `\n` and `endl` now. For example:
```suggestion
      Right.Next->is(tok::string_literal) &&
      ((Left.is(tok::string_literal) && Left.TokenText.ends_with("\\n\"")) ||
       Left.TokenText == "'\\n'" || Left.TokenText == "endl")) {
```

https://github.com/llvm/llvm-project/pull/76795
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to