[PATCH] D153621: [Clang] Correctly handle $, @, and ` when represented as UCN

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 23 04:10:57 PDT 2023


cor3ntin created this revision.
Herald added a project: All.
cor3ntin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This covers

- P2558R2 (C++, wg21.link/P2558 <https://reviews.llvm.org/P2558>)
- N2701 (C, https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2701.htm)
- N3124 (C, https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3124.pdf)

This patch

- Disallow representing $ as a UCN in all language mode, which did not properly work (see GH62133), and which in made ill-formed in C++ and C by P2558 <https://reviews.llvm.org/P2558> and N3124 respectively
- Allow a UCN for any character in C2X, in string and character literals

Fixes #62133


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153621

Files:
  clang/include/clang/Basic/DiagnosticLexKinds.td
  clang/lib/Lex/Lexer.cpp
  clang/lib/Lex/LiteralSupport.cpp
  clang/test/Lexer/char-literal.cpp
  clang/test/Lexer/utf8-char-literal.cpp
  clang/test/Preprocessor/ucn-allowed-chars.c
  clang/test/Preprocessor/ucn-pp-identifier.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153621.533920.patch
Type: text/x-patch
Size: 12421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230623/51b3cb63/attachment-0001.bin>


More information about the cfe-commits mailing list