aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorNaveen Seth Hanig <naveen.hanig@outlook.com>2025-07-19 09:47:37 +0200
committerGitHub <noreply@github.com>2025-07-19 09:47:37 +0200
commit6855b9c598b3258e8c0e3edffe5458630a0b0105 (patch)
tree1ecd4848486f9c11b7151acaa2835cfead4272b3 /clang/lib/Lex/Preprocessor.cpp
parent6b371cab949e3ff9e903d6c3118f4b2be2bf3cc5 (diff)
downloadllvm-6855b9c598b3258e8c0e3edffe5458630a0b0105.zip
llvm-6855b9c598b3258e8c0e3edffe5458630a0b0105.tar.gz
llvm-6855b9c598b3258e8c0e3edffe5458630a0b0105.tar.bz2
[clang][deps] Properly capture the global module and '\n' for all module directives (#148685)
Previously, the newline after a module directive was not properly captured and printed by `clang::printDependencyDirectivesAsSource`. According to P1857R3, each directive must, after skipping horizontal whitespace, appear at the start of a logical line. Because the newline after module directives was missing, this invalidated the following line. This fixes tests that were previously in violation of P1857R3, including for Objective-C directives, which should also comply with P1857R3. This also ensures that the global module fragment `module;` is captured by the dependency directives scanner.
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r--clang/lib/Lex/Preprocessor.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index bcd3ea6..e278846 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -950,6 +950,8 @@ void Preprocessor::Lex(Token &Result) {
case tok::period:
ModuleDeclState.handlePeriod();
break;
+ case tok::eod:
+ break;
case tok::identifier:
// Check "import" and "module" when there is no open bracket. The two
// identifiers are not meaningful with open brackets.