mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Frontend] Move dependency verifier to end of pipeline
Allow the verification of dependencies before LLVM, allowing the freeing of the ASTContext.
This commit is contained in:
@@ -1270,6 +1270,19 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
|
||||
emitAnyWholeModulePostTypeCheckSupplementaryOutputs(Instance);
|
||||
}
|
||||
|
||||
// Verify reference dependencies of the current compilation job. Note this
|
||||
// must be run *before* verifying diagnostics so that the former can be tested
|
||||
// via the latter.
|
||||
if (opts.EnableIncrementalDependencyVerifier) {
|
||||
if (!Instance.getPrimarySourceFiles().empty()) {
|
||||
swift::verifyDependencies(Instance.getSourceMgr(),
|
||||
Instance.getPrimarySourceFiles());
|
||||
} else {
|
||||
swift::verifyDependencies(Instance.getSourceMgr(),
|
||||
Instance.getMainModule()->getFiles());
|
||||
}
|
||||
}
|
||||
|
||||
// Emit dependencies and index data.
|
||||
emitReferenceDependenciesForAllPrimaryInputsIfNeeded(Instance);
|
||||
emitIndexData(Instance);
|
||||
@@ -1555,12 +1568,6 @@ static void freeASTContextIfPossible(CompilerInstance &Instance) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Verifying incremental dependencies relies on access to the Swift Module's
|
||||
// source files.
|
||||
if (opts.EnableIncrementalDependencyVerifier) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If there are multiple primary inputs it is too soon to free
|
||||
// the ASTContext, etc.. OTOH, if this compilation generates code for > 1
|
||||
// primary input, then freeing it after processing the last primary is
|
||||
@@ -2228,19 +2235,6 @@ int swift::performFrontend(ArrayRef<const char *> Args,
|
||||
Invocation.getFrontendOptions().DumpAPIPath);
|
||||
}
|
||||
|
||||
// Verify reference dependencies of the current compilation job *before*
|
||||
// verifying diagnostics so that the former can be tested via the latter.
|
||||
if (Invocation.getFrontendOptions().EnableIncrementalDependencyVerifier) {
|
||||
if (!Instance->getPrimarySourceFiles().empty()) {
|
||||
HadError |= swift::verifyDependencies(Instance->getSourceMgr(),
|
||||
Instance->getPrimarySourceFiles());
|
||||
} else {
|
||||
HadError |= swift::verifyDependencies(
|
||||
Instance->getSourceMgr(),
|
||||
Instance->getMainModule()->getFiles());
|
||||
}
|
||||
}
|
||||
|
||||
if (verifierEnabled) {
|
||||
DiagnosticEngine &diags = Instance->getDiags();
|
||||
if (diags.hasFatalErrorOccurred() &&
|
||||
|
||||
Reference in New Issue
Block a user