[clang] [NFC] Remove dead code in HandleCXXModuleDirective (PR #187737)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 20 09:48:25 PDT 2026
https://github.com/yronglin created https://github.com/llvm/llvm-project/pull/187737
Remove the dead code in `Preprocessor::HandleCXXModuleDirective`.
>From a1b3a569a48beea792fb687a61bce3adde285ac7 Mon Sep 17 00:00:00 2001
From: yronglin <yronglin777 at gmail.com>
Date: Sat, 21 Mar 2026 00:29:40 +0800
Subject: [PATCH] [NFC] Remove dead code in HandleCXXModuleDirective
Signed-off-by: yronglin <yronglin777 at gmail.com>
---
clang/lib/Lex/PPDirectives.cpp | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 2f74199a8e4f3..09f0c3fe8c61e 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -4407,7 +4407,6 @@ void Preprocessor::HandleCXXModuleDirective(Token ModuleTok) {
// Consume the pp-import-suffix and expand any macros in it now, if we're not
// at the semicolon already.
- SourceLocation End = DirToks.back().getLocation();
std::optional<Token> NextPPTok = DirToks.back();
if (DirToks.back().is(tok::eod)) {
NextPPTok = peekNextPPToken();
@@ -4425,14 +4424,14 @@ void Preprocessor::HandleCXXModuleDirective(Token ModuleTok) {
// Consume the pp-import-suffix and expand any macros in it now. We'll add
// it back into the token stream later.
CollectPPImportSuffix(DirToks);
- End = DirToks.back().getLocation();
}
- if (DirToks.back().isNot(tok::eod))
- End = CheckEndOfDirective(ModuleTok.getIdentifierInfo()->getName(),
- /*EnableMacros=*/false, &DirToks);
- else
- End = DirToks.pop_back_val().getLocation();
+ SourceLocation End =
+ DirToks.back().isNot(tok::eod)
+ ? CheckEndOfDirective(ModuleTok.getIdentifierInfo()->getName(),
+ /*EnableMacros=*/false, &DirToks)
+
+ : DirToks.pop_back_val().getLocation();
if (!IncludeMacroStack.empty()) {
Diag(StartLoc, diag::err_pp_module_decl_in_header)
More information about the cfe-commits
mailing list