[clang] [clang][Lex][NFC] Remove unused ShadowModules (PR #239938)

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


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

`ModulesAlloc` manages module lifetimes, making `ShadowModules` redundant.

>From 4b092bab660677754f18603735124ec0fafca528 Mon Sep 17 00:00:00 2001
From: Chen Miao <chenmiao.ku at gmail.com>
Date: Sat, 7 Nov 2026 17:20:07 +0800
Subject: [PATCH] [clang][Lex][NFC] Remove unused ShadowModules

`ModulesAlloc` manages module lifetimes, making `ShadowModules` redundant.
---
 clang/include/clang/Lex/ModuleMap.h | 3 ---
 clang/lib/Lex/ModuleMap.cpp         | 1 -
 2 files changed, 4 deletions(-)

diff --git a/clang/include/clang/Lex/ModuleMap.h b/clang/include/clang/Lex/ModuleMap.h
index e21f645418cb2f..2d27a448b23b7b 100644
--- a/clang/include/clang/Lex/ModuleMap.h
+++ b/clang/include/clang/Lex/ModuleMap.h
@@ -103,9 +103,6 @@ class ModuleMap {
   /// nullptr is stored for modules that are known to fail to load.
   llvm::DenseMap<const IdentifierInfo *, Module *> CachedModuleLoads;
 
-  /// Shadow modules created while building this module map.
-  llvm::SmallVector<Module*, 2> ShadowModules;
-
   /// The number of modules we have created in total.
   unsigned NumCreatedModules = 0;
 
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index 5766d872d73c4e..0591b443cd58d7 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -1325,7 +1325,6 @@ Module *ModuleMap::createShadowedModule(StringRef Name, bool IsFramework,
   Result->ShadowingModule = ShadowingModule;
   Result->markUnavailable(/*Unimportable*/true);
   ModuleScopeIDs[Result] = CurrentModuleScopeID;
-  ShadowModules.push_back(Result);
 
   return Result;
 }



More information about the cfe-commits mailing list