================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits