[clang] [clang][deps] Load module map file from PCM (PR #66389)

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 10:15:51 PDT 2023


================
@@ -1307,6 +1307,9 @@ void ModuleMap::setInferredModuleAllowedBy(Module *M,
 
 std::error_code
 ModuleMap::canonicalizeModuleMapPath(SmallVectorImpl<char> &Path) {
+  FileManager &FM = SourceMgr.getFileManager();
+  FM.makeAbsolutePath(Path);
----------------
jansvoboda11 wrote:

> Is the idea that because the paths used by the scanner is now indirected through the (implicit) pcm that whatever ASTWriter does to make the path relative will apply to the explicit module invocation?

No, because `ASTReader::ReadPath()` does the inverse of `ASTWriter::AddPath()`.

I think we were both talking about different situations. You mean the explicit module invocations generated by the scanner? The canonical module map path would now be absolute. Previously, we'd generate relative paths for module maps found through a relative search paths, or besides includers that themselves were found through a relative path.

I'd be curious about the use-case for this, can you elaborate? Is it being able to reuse the same invocation in directories with different paths, potentially on different machines?

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


More information about the cfe-commits mailing list