Skip to content

Commit 3902244

Browse files
committed
Address PR comments: move module map dependency reporting to ModuleDepCollectorPP::EndOfMainFile.
1 parent 377a157 commit 3902244

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,11 +448,9 @@ void ModuleDepCollector::applyDiscoveredDependencies(CompilerInvocation &CI) {
448448
if (OptionalFileEntryRef CurrentModuleMap =
449449
PP.getHeaderSearchInfo()
450450
.getModuleMap()
451-
.getModuleMapFileForUniquing(CurrentModule)) {
451+
.getModuleMapFileForUniquing(CurrentModule))
452452
CI.getFrontendOpts().ModuleMapFiles.emplace_back(
453453
CurrentModuleMap->getNameAsRequested());
454-
Consumer.handleFileDependency(CurrentModuleMap->getNameAsRequested());
455-
}
456454

457455
SmallVector<ModuleID> DirectDeps;
458456
for (const auto &KV : ModularDeps)
@@ -687,6 +685,13 @@ void ModuleDepCollectorPP::EndOfMainFile() {
687685
if (!MDC.ScanInstance.getPreprocessorOpts().ImplicitPCHInclude.empty())
688686
MDC.addFileDep(MDC.ScanInstance.getPreprocessorOpts().ImplicitPCHInclude);
689687

688+
if (Module *CurrentModule = PP.getCurrentModuleImplementation()) {
689+
if (OptionalFileEntryRef CurrentModuleMap =
690+
PP.getHeaderSearchInfo().getModuleMap().getModuleMapFileForUniquing(
691+
CurrentModule))
692+
MDC.addFileDep(CurrentModuleMap->getNameAsRequested());
693+
}
694+
690695
for (const Module *M :
691696
MDC.ScanInstance.getPreprocessor().getAffectingClangModules())
692697
if (!MDC.isPrebuiltModule(M))

clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
// CHECK-NEXT: "[[PREFIX]]/modules-fmodule-name-no-module-built.m",
4848
// CHECK-NEXT: "[[PREFIX]]/Inputs/header3.h",
4949
// CHECK-NEXT: "[[PREFIX]]/Inputs/header.h",
50-
// CHECK-NEXT: "Inputs/module.modulemap"
50+
// CHECK-NEXT: "[[PREFIX]]/Inputs/module.modulemap"
5151
// CHECK-NEXT: ],
5252
// CHECK-NEXT: "input-file": "[[PREFIX]]/modules-fmodule-name-no-module-built.m"
5353
// CHECK-NEXT: }

0 commit comments

Comments
 (0)