[clang] [clang][modules] Deserialize submodules lazily (PR #194968)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Wed May 6 13:57:43 PDT 2026


================
@@ -1450,7 +1450,7 @@ void Preprocessor::makeModuleVisible(Module *M, SourceLocation Loc,
 
   // Add this module to the imports list of the currently-built submodule.
   if (!BuildingSubmoduleStack.empty() && M != BuildingSubmoduleStack.back().M)
-    BuildingSubmoduleStack.back().M->Imports.insert(M);
+    BuildingSubmoduleStack.back().M->Imports.push_back(M);
----------------
jansvoboda11 wrote:

Yes. I didn't spend much time working out how to quickly check whether one `ModuleRef` that only contains `Module *` corresponds to another `ModuleRef` that only contains the `ExternalSubmoduleSource` and `SubmoduleID`. Since all tests pass, I'm assuming this would be just a performance optimization rather than correctness fix, and the performance is much improved even without the deduplication here.

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


More information about the cfe-commits mailing list