[clang] [Clang] allow `` `@$ `` in raw string delimiters in C++26 (PR #93216)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 11 13:56:57 PDT 2024
================
@@ -2261,8 +2261,17 @@ bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr,
unsigned PrefixLen = 0;
- while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen]))
+ while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) {
++PrefixLen;
+ if (!isLexingRawMode() &&
+ llvm::is_contained({'$', '@', '`'}, CurPtr[PrefixLen])) {
----------------
zygoloid wrote:
There's an off-by-one error here: we're incrementing `PrefixLen` before checking the character, so this is checking the character *after* the one we just processed. Hence we don't diagnose `"@(foo)@"`, because the characters we look at are the `(` and `"` after the `@`s, not the `@`s themselves.
https://github.com/llvm/llvm-project/pull/93216
More information about the cfe-commits
mailing list