File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Sources/SwiftDriver/Incremental Compilation Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -272,14 +272,20 @@ extension IncrementalCompilationState {
272272 }
273273 let modDate = buildRecordInfo. compilationInputModificationDates [ input]
274274 ?? Date . distantFuture
275- let previousCompilationStatus = outOfDateBuildRecord
276- . inputInfos [ input. file] ? . status ?? . newlyAdded
275+ let inputInfo = outOfDateBuildRecord. inputInfos [ input. file]
276+ let previousCompilationStatus = inputInfo? . status ?? . newlyAdded
277+ let previousModTime = inputInfo? . previousModTime
278+
279+ // Because legacy driver reads/writes dates wrt 1970,
280+ // and because converting time intervals to/from Dates from 1970
281+ // exceeds Double precision, must not compare dates directly
282+ var datesMatch : Bool {
283+ modDate. timeIntervalSince1970 == previousModTime? . timeIntervalSince1970
284+ }
277285
278286 switch previousCompilationStatus {
279- // Using outOfDateBuildRecord.inputInfos[input.file]?.previousModTime
280- // has some inaccuracy.
281- // Use outOfDateBuildRecord.buildTime instead
282- case . upToDate where modDate < outOfDateBuildRecord. buildTime:
287+
288+ case . upToDate where datesMatch:
283289 reportIncrementalDecision ? ( " May skip current input: " , input)
284290 return nil
285291
You can’t perform that action at this time.
0 commit comments