[clang] [clang-format] Handle Trailing Whitespace After Line Continuation (P2223R2) (PR #145243)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 23 22:08:28 PDT 2025


================
@@ -1205,14 +1206,23 @@ static size_t countLeadingWhitespace(StringRef Text) {
   while (Cur < End) {
     if (isspace(Cur[0])) {
       ++Cur;
-    } else if (Cur[0] == '\\' && (Cur[1] == '\n' || Cur[1] == '\r')) {
-      // A '\' followed by a newline always escapes the newline, regardless
-      // of whether there is another '\' before it.
+    } else if (Cur[0] == '\\') {
+      // A '\' followed by a optional horizontal whitespace (P22232R2) and then
+      // newline  always escapes the newline, regardless  of whether there is
+      // another '\' before it.
----------------
owenca wrote:

```suggestion
      // A backslash followed by optional horizontal whitespaces (P22232R2) and
      // then a newline always escapes the newline.
```

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


More information about the cfe-commits mailing list