@@ -258,12 +258,19 @@ namespace driver {
258
258
llvm::SmallDenseMap<const Job *, std::unique_ptr<llvm::Timer>, 16 >
259
259
DriverTimers;
260
260
261
- void noteBuilding (const Job *cmd, const bool forRanges, StringRef reason) {
261
+ void noteBuilding (const Job *cmd, const bool willBeBuilding,
262
+ const bool forRanges, StringRef reason) {
262
263
if (!Comp.getShowIncrementalBuildDecisions ())
263
264
return ;
264
265
if (ScheduledCommands.count (cmd))
265
266
return ;
266
- llvm::outs () << " Queuing "
267
+ if (!Comp.getEnableSourceRangeDependencies () &&
268
+ !Comp.CompareIncrementalSchemes && !willBeBuilding)
269
+ return ; // preserve legacy behavior
270
+ const bool isHypothetical =
271
+ Comp.getUseSourceRangeDependencies () == forRanges;
272
+ llvm::outs () << (isHypothetical ? " Hypothetically: " : " " )
273
+ << (willBeBuilding ? " Queuing " : " Skipping " )
267
274
<< (forRanges ? " <Ranges> "
268
275
: Comp.getEnableSourceRangeDependencies ()
269
276
? " <Dependencies> "
@@ -666,7 +673,7 @@ namespace driver {
666
673
667
674
for (const Job *Cmd : Dependents) {
668
675
DeferredCommands.erase (Cmd);
669
- noteBuilding (Cmd, Comp.getUseSourceRangeDependencies (),
676
+ noteBuilding (Cmd, true , Comp.getUseSourceRangeDependencies (),
670
677
" because of dependencies discovered later" );
671
678
scheduleCommandIfNecessaryAndPossible (Cmd);
672
679
}
@@ -753,8 +760,6 @@ namespace driver {
753
760
return {};
754
761
// FIXME: crude, could just use dependencies to schedule only those jobs
755
762
// depending on the added tops
756
- assert (Comp.getEnableSourceRangeDependencies () &&
757
- " only implementing this for those" );
758
763
const size_t topsBefore = countTopLevelProvides (FinishedCmd);
759
764
760
765
SmallVector<const Job *, 16 > jobsForDependencies;
@@ -999,17 +1004,23 @@ namespace driver {
999
1004
llvm::SmallVector<const Job *, 16 > neededJobs;
1000
1005
for (const Job *Cmd : Comp.getJobs ()) {
1001
1006
if (SourceRangeBasedInfo::shouldScheduleCompileJob (
1002
- allSourceRangeInfo, Cmd,
1003
- [&](Twine why) { noteBuilding (Cmd, true , why.str ()); }))
1007
+ allSourceRangeInfo, Cmd, [&](const bool willBuild, Twine why) {
1008
+ noteBuilding (Cmd, willBuild, true , why.str ());
1009
+ }))
1004
1010
neededJobs.push_back (Cmd);
1005
1011
}
1006
1012
1007
1013
llvm::SmallVector<const Job *, 16 > jobsLackingSupplementaryOutputs;
1008
1014
for (const Job *Cmd : Comp.getJobs ()) {
1009
1015
auto pri = Cmd->getFirstSwiftPrimaryInput ();
1010
- if (pri.empty () || allSourceRangeInfo.count (pri))
1011
- continue ;
1012
- noteBuilding (Cmd, true ,
1016
+ if (pri.empty ())
1017
+ if (allSourceRangeInfo.count (pri)) {
1018
+ noteBuilding (
1019
+ Cmd, false , true ,
1020
+ " already have source-range and compiled-source files." );
1021
+ continue ;
1022
+ }
1023
+ noteBuilding (Cmd, true , true ,
1013
1024
" to create source-range and compiled-source files for the "
1014
1025
" next time when falling back from source-ranges" );
1015
1026
jobsLackingSupplementaryOutputs.push_back (Cmd);
@@ -1140,9 +1151,10 @@ namespace driver {
1140
1151
}
1141
1152
LLVM_FALLTHROUGH;
1142
1153
case Job::Condition::RunWithoutCascading:
1143
- noteBuilding (Cmd, false , " (initial)" );
1154
+ noteBuilding (Cmd, true , false , " (initial)" );
1144
1155
return true ;
1145
1156
case Job::Condition::CheckDependencies:
1157
+ noteBuilding (Cmd, false , false , " flie is up-to-date and output exists" );
1146
1158
return false ;
1147
1159
}
1148
1160
}
@@ -1167,7 +1179,8 @@ namespace driver {
1167
1179
1168
1180
for (auto *externalCmd :
1169
1181
llvm::makeArrayRef (AdditionalOutOfDateCommands).slice (firstSize)) {
1170
- noteBuilding (externalCmd, false , " because of external dependencies" );
1182
+ noteBuilding (externalCmd, true , false ,
1183
+ " because of external dependencies" );
1171
1184
}
1172
1185
return AdditionalOutOfDateCommands;
1173
1186
}
@@ -1183,7 +1196,7 @@ namespace driver {
1183
1196
externalSwiftDeps, [&](const void *node) {
1184
1197
// Sadly, the non-experimental dependency graph is type-unsafe
1185
1198
const Job *externalCmd = reinterpret_cast <const Job *>(node);
1186
- noteBuilding (externalCmd, true ,
1199
+ noteBuilding (externalCmd, true , true ,
1187
1200
" because of external dependencies" );
1188
1201
results.push_back (externalCmd);
1189
1202
});
@@ -1218,7 +1231,7 @@ namespace driver {
1218
1231
IncrementalTracer);
1219
1232
}
1220
1233
for (auto *transitiveCmd : AdditionalOutOfDateCommands)
1221
- noteBuilding (transitiveCmd, false , " because of the initial set" );
1234
+ noteBuilding (transitiveCmd, true , false , " because of the initial set" );
1222
1235
1223
1236
return AdditionalOutOfDateCommands;
1224
1237
}
0 commit comments