ldrumm wrote: Should we be looking for `\r` as well?
If the testcase is checked out with DOS line endings (e.g. on a windows machine), then the test clang/test/Lexer/raw-string-dlim-invalid.cpp fails I don't know what the C++ spec says, but I think this diagnostic should work for both common end of line styles. Something like this: ```diff diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index c98645993abe..80495e0677a0 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2258,7 +2258,7 @@ bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, if (!isLexingRawMode()) Diag(BufferPtr, diag::warn_cxx98_compat_raw_string_literal); - +i unsigned PrefixLen = 0; while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) @@ -2270,7 +2270,7 @@ bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, const char *PrefixEnd = &CurPtr[PrefixLen]; if (PrefixLen == 16) { Diag(PrefixEnd, diag::err_raw_delim_too_long); - } else if (*PrefixEnd == '\n') { + } else if ((*PrefixEnd == '\r' && PrefixEnd[1] == '\n') || *PrefixEnd == '\n') { Diag(PrefixEnd, diag::err_invalid_newline_raw_delim); } else { Diag(PrefixEnd, diag::err_invalid_char_raw_delim) ``` ? https://github.com/llvm/llvm-project/pull/81670 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits