[clang] [clang][Lex][NFC] Remove unused ModuleDeclLoc (PR #239947)

Chen Miao via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 7 01:52:26 PST 2026


https://github.com/ChenMiaoi created https://github.com/llvm/llvm-project/pull/239947

`ModuleDeclLoc` is assigned but never read.

>From 520b287ae50ca134a8437e3646ae5b9c2396fdae Mon Sep 17 00:00:00 2001
From: Chen Miao <chenmiao.ku at gmail.com>
Date: Sat, 7 Nov 2026 17:47:17 +0800
Subject: [PATCH] [clang][Lex][NFC] Remove unused ModuleDeclLoc

`ModuleDeclLoc` is assigned but never read.
---
 clang/include/clang/Lex/Preprocessor.h | 4 ----
 clang/lib/Lex/Preprocessor.cpp         | 1 -
 2 files changed, 5 deletions(-)

diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 31b68a0fd0670e..2d0c24b92334a3 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -376,10 +376,6 @@ class Preprocessor {
   /// lexed, if any.
   SourceLocation ModuleImportLoc;
 
-  /// The source location of the \c module contextual keyword we just
-  /// lexed, if any.
-  SourceLocation ModuleDeclLoc;
-
   llvm::DenseMap<FileID, SmallVector<const char *>> CheckPoints;
   unsigned CheckPointCounter = 0;
 
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index a8717424f1d155..d3a56f726b7b85 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -1424,7 +1424,6 @@ bool Preprocessor::HandleModuleContextualKeyword(Token &Result) {
         LookUpIdentifierInfo(*NextTok);
       if (NextTok->isOneOf(tok::identifier, tok::colon, tok::semi)) {
         Result.setKind(tok::kw_module);
-        ModuleDeclLoc = Result.getLocation();
         return true;
       }
     }



More information about the cfe-commits mailing list