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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits