[Frontend] Internalize createDependencyTracker

Expand the FrontendOptions to allow the enabling
of the dependency tracker for non-system
dependencies, and switch the previous clients of
`createDependencyTracker` over to using this
option. This ensures that the dependency tracker
is now set only during `CompilerInstance::setup`.
This commit is contained in:
Hamish Knight
2020-06-29 15:26:26 -07:00
parent bddcda6333
commit 7bc5440d17
13 changed files with 80 additions and 41 deletions

View File

@@ -1126,9 +1126,14 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
GenericArgs.push_back("-prebuilt-module-cache-path");
GenericArgs.push_back(prebuiltCachePath);
}
subInvocation.getFrontendOptions().TrackSystemDeps = trackSystemDependencies;
if (trackSystemDependencies) {
subInvocation.getFrontendOptions().IntermoduleDependencyTracking =
IntermoduleDepTrackingMode::IncludeSystem;
GenericArgs.push_back("-track-system-dependencies");
} else {
// Always track at least the non-system dependencies for interface building.
subInvocation.getFrontendOptions().IntermoduleDependencyTracking =
IntermoduleDepTrackingMode::ExcludeSystem;
}
if (LoaderOpts.disableImplicitSwiftModule) {
subInvocation.getFrontendOptions().DisableImplicitModules = true;
@@ -1252,7 +1257,7 @@ InterfaceSubContextDelegateImpl::getCacheHash(StringRef useInterfacePath) {
// Whether or not we're tracking system dependencies affects the
// invalidation behavior of this cache item.
subInvocation.getFrontendOptions().TrackSystemDeps);
subInvocation.getFrontendOptions().shouldTrackSystemDependencies());
return llvm::APInt(64, H).toString(36, /*Signed=*/false);
}
@@ -1330,8 +1335,6 @@ bool InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleN
ForwardingDiagnosticConsumer FDC(Diags);
subInstance.addDiagnosticConsumer(&FDC);
subInstance.createDependencyTracker(subInvocation.getFrontendOptions()
.TrackSystemDeps);
if (subInstance.setup(subInvocation)) {
return true;
}