[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
Fri Oct 17 18:29:07 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:

Let's take a step back. What use cases do you have for "file-deps"? Because I've realized that for reproducers I'm not interested in the _output paths_ to process them somehow. Actually, I want to take the paths and provide them to the compiler as the _input_.

I'm considering if we should have 2 flavours of file dependencies - one before all the file system remappings and one after clang applied the remappings.

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


More information about the cfe-commits mailing list