[PATCH] D71758: [Lexer] Allow UCN for dollar symbol '\u0024' in identifiers when using -fdollars-in-identifiers flag.
Scott Egerton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 15 03:33:23 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa90ea386981f: [Lexer] Allow UCN for dollar symbol '\u0024' in identifiers when using… (authored by s.egerton).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71758/new/
https://reviews.llvm.org/D71758
Files:
clang/lib/Lex/Lexer.cpp
clang/test/Preprocessor/ucn-pp-identifier.c
Index: clang/test/Preprocessor/ucn-pp-identifier.c
===================================================================
--- clang/test/Preprocessor/ucn-pp-identifier.c
+++ clang/test/Preprocessor/ucn-pp-identifier.c
@@ -28,8 +28,7 @@
#define \U10000000 // expected-error {{macro name must be an identifier}}
#define \u0061 // expected-error {{character 'a' cannot be specified by a universal character name}} expected-error {{macro name must be an identifier}}
-// FIXME: Not clear what our behavior should be here; \u0024 is "$".
-#define a\u0024 // expected-warning {{whitespace}}
+#define a\u0024
#if \u0110 // expected-warning {{is not defined, evaluates to 0}}
#endif
Index: clang/lib/Lex/Lexer.cpp
===================================================================
--- clang/lib/Lex/Lexer.cpp
+++ clang/lib/Lex/Lexer.cpp
@@ -1431,6 +1431,8 @@
static bool isAllowedIDChar(uint32_t C, const LangOptions &LangOpts) {
if (LangOpts.AsmPreprocessor) {
return false;
+ } else if (LangOpts.DollarIdents && '$' == C) {
+ return true;
} else if (LangOpts.CPlusPlus11 || LangOpts.C11) {
static const llvm::sys::UnicodeCharSet C11AllowedIDChars(
C11AllowedIDCharRanges);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71758.238213.patch
Type: text/x-patch
Size: 1206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200115/0d95d766/attachment.bin>
More information about the cfe-commits
mailing list