@@ -206,9 +206,10 @@ namespace driver {
206
206
// / Jobs that incremental-mode has decided it can skip.
207
207
CommandSet DeferredCommands;
208
208
209
- // / Jobs in the initial set with Condition::Always, or lacking existing
209
+ // / Jobs in the initial set with Condition::Always, and having an existing
210
210
// / .swiftdeps files.
211
- SmallVector<const Job *, 16 > InitialOutOfDateCommands;
211
+ // / Set by scheduleInitialJobs and used only by scheduleAdditionalJobs.
212
+ SmallVector<const Job *, 16 > InitialCascadingCommands;
212
213
213
214
// / Dependency graph for deciding which jobs are dirty (need running)
214
215
// / or clean (can be skipped).
@@ -382,7 +383,7 @@ namespace driver {
382
383
DeferredCommands.clear ();
383
384
}
384
385
385
- // / Helper that attmepts to reload a job's .swiftdeps file after the job
386
+ // / Helper that attempts to reload a job's .swiftdeps file after the job
386
387
// / exits, and re-run transitive marking to ensure everything is properly
387
388
// / invalidated by any new dependency edges introduced by it. If reloading
388
389
// / fails, this can cause deferred jobs to be immediately scheduled.
@@ -406,6 +407,13 @@ namespace driver {
406
407
// If we have a dependency file /and/ the frontend task exited normally,
407
408
// we can be discerning about what downstream files to rebuild.
408
409
if (ReturnCode == EXIT_SUCCESS || ReturnCode == EXIT_FAILURE) {
410
+ // "Marked" means that everything provided by this node (i.e. Job) is
411
+ // dirty. Thus any file using any of these provides must be
412
+ // recompiled. (Only non-private entities are output as provides.) In
413
+ // other words, this Job "cascades"; the need to recompile it causes
414
+ // other recompilations. It is possible that the current code marks
415
+ // things that do not need to be marked. Unecessary compilation would
416
+ // result if that were the case.
409
417
bool wasCascading = DepGraph.isMarked (FinishedCmd);
410
418
411
419
switch (DepGraph.loadFromPath (FinishedCmd, DependenciesFile)) {
@@ -715,7 +723,15 @@ namespace driver {
715
723
switch (Condition) {
716
724
case Job::Condition::Always:
717
725
if (Comp.getIncrementalBuildEnabled () && !DependenciesFile.empty ()) {
718
- InitialOutOfDateCommands.push_back (Cmd);
726
+ // Ensure dependents will get recompiled.
727
+ InitialCascadingCommands.push_back (Cmd);
728
+ // Mark this job as cascading.
729
+ //
730
+ // It would probably be safe and simpler to markTransitive on the
731
+ // start nodes in the "Always" condition from the start instead of
732
+ // using markIntransitive and having later functions call
733
+ // markTransitive. That way markIntransitive would be an
734
+ // implementation detail of DependencyGraph.
719
735
DepGraph.markIntransitive (Cmd);
720
736
}
721
737
LLVM_FALLTHROUGH;
@@ -740,7 +756,7 @@ namespace driver {
740
756
// We scheduled all of the files that have actually changed. Now add the
741
757
// files that haven't changed, so that they'll get built in parallel if
742
758
// possible and after the first set of files if it's not.
743
- for (auto *Cmd : InitialOutOfDateCommands ) {
759
+ for (auto *Cmd : InitialCascadingCommands ) {
744
760
DepGraph.markTransitive (AdditionalOutOfDateCommands, Cmd,
745
761
IncrementalTracer);
746
762
}
0 commit comments