[clang] clang-format: Add splitting for strings with user-defined suffixes (PR #167150)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 9 15:02:25 PST 2025


================
@@ -274,9 +277,14 @@ void BreakableStringLiteral::insertBreak(unsigned LineIndex,
                                          unsigned TailOffset, Split Split,
                                          unsigned ContentIndent,
                                          WhitespaceManager &Whitespaces) const {
+
+  const unsigned SplitEnd = TailOffset + Split.first + Split.second;
+  const bool IsLastFragment = SplitEnd > Line.size() - UnbreakableTailLength;
+  StringRef LocalPostfix = (IsLastFragment) ? Postfix : ContinuationPostfix;
----------------
HazardyKnusperkeks wrote:

```suggestion
  const StringRef LocalPostfix = IsLastFragment ? Postfix : ContinuationPostfix;
```

https://github.com/llvm/llvm-project/pull/167150


More information about the cfe-commits mailing list