aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorDmitry Polukhin <34227995+dmpolukhin@users.noreply.github.com>2024-10-11 08:23:35 +0100
committerGitHub <noreply@github.com>2024-10-11 08:23:35 +0100
commit65780f4d8e34461e6bd3baf2ff77496f97874b94 (patch)
treecf8c04097641f7c2f3de4cdd1d3b39c7afdaac61 /clang/lib/Lex/Preprocessor.cpp
parent173c68239d1d11f4e36c8af07a28310da67568a7 (diff)
downloadllvm-65780f4d8e34461e6bd3baf2ff77496f97874b94.zip
llvm-65780f4d8e34461e6bd3baf2ff77496f97874b94.tar.gz
llvm-65780f4d8e34461e6bd3baf2ff77496f97874b94.tar.bz2
[C++20][Modules] Allow import for a header unit after #pragma (#111662)
Summary: `#pragma` and headers that finish with them shouldn't prevent `import "header_unit.h"` syntax. Test Plan: check-clang
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index f0b4593..ecc5166 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -902,6 +902,10 @@ void Preprocessor::Lex(Token &Result) {
case tok::r_brace:
StdCXXImportSeqState.handleCloseBrace();
break;
+#define PRAGMA_ANNOTATION(X) case tok::annot_##X:
+// For `#pragma ...` mimic ';'.
+#include "clang/Basic/TokenKinds.def"
+#undef PRAGMA_ANNOTATION
// This token is injected to represent the translation of '#include "a.h"'
// into "import a.h;". Mimic the notional ';'.
case tok::annot_module_include: