================
@@ -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;
+ }
----------------
Bigcheese wrote:
This only causes problems when lazy loading is enabled, otherwise we load
PCMs/module maps in a different order that doesn't expose this issue. When
loading the module map first it correctly sets the directory.
Maybe this can be reproduced with an explicit build, `-fmodule-file=` and `
#pragma clang __debug module_map`? I'll see if that works.
https://github.com/llvm/llvm-project/pull/181916
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits