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

Ben Langmuir via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 15 10:41:39 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);
----------------
benlangmuir wrote:

> 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.

Yes, this change is what I'm concerned about.

> 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?

My understanding is that this can be used to make the .pcms and command-lines to build them portable across machines, e.g. for caching builds in tools like bazel.  I don't know how much overlap there is between this use case and using the dependency scanner.

Maybe we can flip it around: where exactly do we need an absolute path with your changes?

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


More information about the cfe-commits mailing list