[clang] [clang][modulemap] Lazily load module maps by header name (PR #181916)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 18 14:04:43 PST 2026
================
@@ -6316,6 +6316,15 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile &F,
CurrentModule->ConfigMacrosExhaustive = ConfigMacrosExhaustive;
CurrentModule->ModuleMapIsPrivate = ModuleMapIsPrivate;
CurrentModule->NamedModuleHasInit = NamedModuleHasInit;
+
+ if (!ParentModule && !F.BaseDirectory.empty()) {
+ if (auto Dir = FileMgr.getOptionalDirectoryRef(F.BaseDirectory))
+ CurrentModule->Directory = *Dir;
+ } else if (ParentModule && ParentModule->Directory) {
+ // Submodules inherit the directory from their parent.
+ CurrentModule->Directory = ParentModule->Directory;
+ }
----------------
jansvoboda11 wrote:
This technically doesn't depend on the rest of this patch, right? Could we extract it into a separate commit? And add a test for this specifically?
https://github.com/llvm/llvm-project/pull/181916
More information about the cfe-commits
mailing list