[clang] [clang-format] Correctly annotate C# UTF 8 string literals (PR #211919)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 26 23:54:43 PDT 2026
================
@@ -455,6 +457,28 @@ bool FormatTokenLexer::tryMergeCSharpStringLiteral() {
return true;
}
+bool FormatTokenLexer::tryMergeCSharpUtf8StringLiteral() {
+ if (Tokens.size() < 2)
+ return false;
+
+ auto Suffix = Tokens.back();
+ if (Suffix->isNot(tok::identifier) || Suffix->TokenText != "u8")
----------------
owenca wrote:
```suggestion
if (Suffix->TokenText != "u8")
```
This would work? Also, we should add "no whitespace before Suffix" so that `"foo" u8`, which is invalid C#, doesn't get merged.
https://github.com/llvm/llvm-project/pull/211919
More information about the cfe-commits
mailing list