[clang] Fix preprocessed block comment newline on windows containing extra carriage return (PR #205084)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 08:46:07 PDT 2026


================
@@ -1022,7 +1040,10 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok,
     } else if (Tok.getLength() < std::size(Buffer)) {
       const char *TokPtr = Buffer;
       unsigned Len = PP.getSpelling(Tok, TokPtr);
-      Callbacks->OS->write(TokPtr, Len);
+      if (Tok.is(tok::comment))
----------------
AaronBallman wrote:

```suggestion
      if (Tok.is(tok::comment, tok::unknown))
```
I think unknown tokens can also have embedded newlines; code elsewhere is handling them. But this brings up a different question: are raw string literals with embedded CRLFs handled incorrectly too?

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


More information about the cfe-commits mailing list