From e77a01d79a48e15c94c89e4aa4bd27424a96b49b Mon Sep 17 00:00:00 2001 From: yronglin Date: Sat, 20 Jul 2024 20:41:00 +0800 Subject: =?UTF-8?q?[Clang]=20Implement=20P3034R1=20Module=20Declarations?= =?UTF-8?q?=20Shouldn=E2=80=99t=20be=20Macros=20(#90574)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR implement [P3034R1 Module Declarations Shouldn’t be Macros](https://wg21.link/P3034R1), and refactor the convoluted state machines in module name lexical analysis. --------- Signed-off-by: yronglin Co-authored-by: Aaron Ballman Co-authored-by: cor3ntin --- clang/lib/Parse/ParseDecl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'clang/lib/Parse/ParseDecl.cpp') diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 7ce9a9c..577527d 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -3958,7 +3958,13 @@ void Parser::ParseDeclarationSpecifiers( // We're done with the declaration-specifiers. goto DoneWithDeclSpec; - + case tok::annot_module_name: { + PP.EnterTokenStream( + Tok.getAnnotationValueAs()->getTokens(), + /*DisableMacroExpansion=*/true, /*IsReinject=*/false); + ConsumeAnyToken(); + [[fallthrough]]; + } // typedef-name case tok::kw___super: case tok::kw_decltype: -- cgit v1.1