[clang] [clang][deps] Add module map describing compiled module to file dependencies. (PR #160226)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 2 11:00:43 PDT 2025
================
@@ -444,9 +444,11 @@ void ModuleDepCollector::applyDiscoveredDependencies(CompilerInvocation &CI) {
if (OptionalFileEntryRef CurrentModuleMap =
PP.getHeaderSearchInfo()
.getModuleMap()
- .getModuleMapFileForUniquing(CurrentModule))
+ .getModuleMapFileForUniquing(CurrentModule)) {
CI.getFrontendOpts().ModuleMapFiles.emplace_back(
CurrentModuleMap->getNameAsRequested());
+ Consumer.handleFileDependency(CurrentModuleMap->getNameAsRequested());
----------------
jansvoboda11 wrote:
I think this should be just `->getName()` - the build system won't know how to map between the as-requested path and the on-disk path.
I'd also prefer if we did this in `ModuleDepCollectorPP::EndOfMainFile()`. This function should just modify the `CI` with the information collected so far, not perform more logic and reporting. It may also get called multiple times for a driver command, and re-invoking the `Consumer` doesn't make sense IMO.
https://github.com/llvm/llvm-project/pull/160226
More information about the cfe-commits
mailing list