[clang] [clang][deps] Add module map describing compiled module to file dependencies. (PR #160226)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 29 23:14:43 PDT 2025


================
@@ -685,6 +685,13 @@ void ModuleDepCollectorPP::EndOfMainFile() {
   if (!MDC.ScanInstance.getPreprocessorOpts().ImplicitPCHInclude.empty())
     MDC.addFileDep(MDC.ScanInstance.getPreprocessorOpts().ImplicitPCHInclude);
 
+  if (Module *CurrentModule = PP.getCurrentModuleImplementation()) {
+    if (OptionalFileEntryRef CurrentModuleMap =
+            PP.getHeaderSearchInfo().getModuleMap().getModuleMapFileForUniquing(
+                CurrentModule))
+      MDC.addFileDep(CurrentModuleMap->getName());
----------------
vsapsai wrote:

Have experimented with it a little bit and looks like having output paths (like now) and remappers (specifically VFS overlays) in file-deps is enough. With these clang can find which output path corresponds to an input path.

These are preliminary results, I'm going to implement a more appropriate solution in this direction and see how it works.

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


More information about the cfe-commits mailing list