[PATCH] D146924: [clang] Add support for dollar sign in ud_suffix of numeric constants
Anna Arad via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 26 12:27:17 PDT 2023
annara created this revision.
Herald added a project: All.
annara requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146924
Files:
clang/lib/Lex/Lexer.cpp
clang/test/CXX/lex/lex.literal/lex.ext/p3.cpp
Index: clang/test/CXX/lex/lex.literal/lex.ext/p3.cpp
===================================================================
--- clang/test/CXX/lex/lex.literal/lex.ext/p3.cpp
+++ clang/test/CXX/lex/lex.literal/lex.ext/p3.cpp
@@ -16,3 +16,6 @@
template<char...Cs> constexpr int operator "" _x3() { return sizeof...(Cs); }
static_assert(123456789012345678901234567890123456789012345678901234567890_x3 == 60, "");
+
+int operator "" _$ (unsigned long long);
+int i6 = 42_$;
Index: clang/lib/Lex/Lexer.cpp
===================================================================
--- clang/lib/Lex/Lexer.cpp
+++ clang/lib/Lex/Lexer.cpp
@@ -1971,6 +1971,10 @@
return LexNumericConstant(Result, CurPtr);
if (!isASCII(C) && tryConsumeIdentifierUTF8Char(CurPtr))
return LexNumericConstant(Result, CurPtr);
+ if (C == '$' && LangOpts.DollarIdents) {
+ CurPtr = ConsumeChar(CurPtr, Size, Result);
+ return LexNumericConstant(Result, CurPtr);
+ }
// Update the location of token as well as BufferPtr.
const char *TokStart = BufferPtr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146924.508438.patch
Type: text/x-patch
Size: 1047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230326/5c1a9131/attachment-0001.bin>
More information about the cfe-commits
mailing list