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

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


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Chen Miao (ChenMiaoi)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/239938.diff


2 Files Affected:

- (modified) clang/include/clang/Lex/ModuleMap.h (-3) 
- (modified) clang/lib/Lex/ModuleMap.cpp (-1) 


``````````diff
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;
 }

``````````

</details>


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


More information about the cfe-commits mailing list