[clang] [clang-format] Fix first-line width calculation for CRLF multiline tokens (PR #228752)

via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 8 01:21:27 PDT 2026


================
@@ -16681,6 +16681,23 @@ TEST_F(FormatTest, CountsCharactersInMultilineRawStringLiterals) {
                " R\"(single line raw string)\" + bbbbbb);");
 }
 
+TEST_F(FormatTest, MultilineRawStringWidthWithCRLF) {
+  auto Style = getWebKitStyle();
----------------
w1m024 wrote:

The `WebKit` style isn't required. The current test case was reduced from the original reproducer in #224571. Whether it reproduces the issue depends on the combination of style options, and `WebKit` is one that exposes it.

A simpler test case also reproduces the same issue:
```cpp
auto Style = getLLVMStyleWithColumns(23);

verifyNoChange("fffffffffff(R\"(aaaaaaaa\n"
               ")\");",
               Style);
verifyNoChange("fffffffffff(R\"(aaaaaaaa\r\n"
               ")\");",
               Style);
```

Should I use this simpler test case instead?

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


More information about the cfe-commits mailing list