Clarify ownership of DepTracker.

This commit is contained in:
David Ungar
2018-05-16 14:37:57 -07:00
parent 21346419ca
commit df4048c995
3 changed files with 12 additions and 20 deletions

View File

@@ -1756,17 +1756,10 @@ int swift::performFrontend(ArrayRef<const char *> Args,
enableDiagnosticVerifier(Instance->getSourceMgr());
}
// Do not move into the following block. Even though it appears to not be
// referenced, depTracker must live as long as this activation record.
DependencyTracker depTracker;
{
const FrontendInputsAndOutputs &io =
Invocation.getFrontendOptions().InputsAndOutputs;
if (io.hasDependencyTrackerPath() ||
!Invocation.getFrontendOptions().IndexStorePath.empty()) {
Instance->setDependencyTracker(&depTracker);
}
}
if (Invocation.getFrontendOptions()
.InputsAndOutputs.hasDependencyTrackerPath() ||
!Invocation.getFrontendOptions().IndexStorePath.empty())
Instance->createDependencyTracker();
if (Instance->setup(Invocation)) {
return finishDiagProcessing(1);