@@ -1270,6 +1270,19 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
1270
1270
emitAnyWholeModulePostTypeCheckSupplementaryOutputs (Instance);
1271
1271
}
1272
1272
1273
+ // Verify reference dependencies of the current compilation job. Note this
1274
+ // must be run *before* verifying diagnostics so that the former can be tested
1275
+ // via the latter.
1276
+ if (opts.EnableIncrementalDependencyVerifier ) {
1277
+ if (!Instance.getPrimarySourceFiles ().empty ()) {
1278
+ swift::verifyDependencies (Instance.getSourceMgr (),
1279
+ Instance.getPrimarySourceFiles ());
1280
+ } else {
1281
+ swift::verifyDependencies (Instance.getSourceMgr (),
1282
+ Instance.getMainModule ()->getFiles ());
1283
+ }
1284
+ }
1285
+
1273
1286
// Emit dependencies and index data.
1274
1287
emitReferenceDependenciesForAllPrimaryInputsIfNeeded (Instance);
1275
1288
emitIndexData (Instance);
@@ -1555,12 +1568,6 @@ static void freeASTContextIfPossible(CompilerInstance &Instance) {
1555
1568
return ;
1556
1569
}
1557
1570
1558
- // Verifying incremental dependencies relies on access to the Swift Module's
1559
- // source files.
1560
- if (opts.EnableIncrementalDependencyVerifier ) {
1561
- return ;
1562
- }
1563
-
1564
1571
// If there are multiple primary inputs it is too soon to free
1565
1572
// the ASTContext, etc.. OTOH, if this compilation generates code for > 1
1566
1573
// primary input, then freeing it after processing the last primary is
@@ -2228,19 +2235,6 @@ int swift::performFrontend(ArrayRef<const char *> Args,
2228
2235
Invocation.getFrontendOptions ().DumpAPIPath );
2229
2236
}
2230
2237
2231
- // Verify reference dependencies of the current compilation job *before*
2232
- // verifying diagnostics so that the former can be tested via the latter.
2233
- if (Invocation.getFrontendOptions ().EnableIncrementalDependencyVerifier ) {
2234
- if (!Instance->getPrimarySourceFiles ().empty ()) {
2235
- HadError |= swift::verifyDependencies (Instance->getSourceMgr (),
2236
- Instance->getPrimarySourceFiles ());
2237
- } else {
2238
- HadError |= swift::verifyDependencies (
2239
- Instance->getSourceMgr (),
2240
- Instance->getMainModule ()->getFiles ());
2241
- }
2242
- }
2243
-
2244
2238
if (verifierEnabled) {
2245
2239
DiagnosticEngine &diags = Instance->getDiags ();
2246
2240
if (diags.hasFatalErrorOccurred () &&
0 commit comments