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 @@ -275,14 +275,20 @@ extension IncrementalCompilationState {
275275 }
276276 let modDate = buildRecordInfo. compilationInputModificationDates [ input]
277277 ?? Date . distantFuture
278- let previousCompilationStatus = outOfDateBuildRecord
279- . inputInfos [ input. file] ? . status ?? . newlyAdded
278+ let inputInfo = outOfDateBuildRecord. inputInfos [ input. file]
279+ let previousCompilationStatus = inputInfo? . status ?? . newlyAdded
280+ let previousModTime = inputInfo? . previousModTime
281+
282+ // Because legacy driver reads/writes dates wrt 1970,
283+ // and because converting time intervals to/from Dates from 1970
284+ // exceeds Double precision, must not compare dates directly
285+ var datesMatch : Bool {
286+ modDate. timeIntervalSince1970 == previousModTime? . timeIntervalSince1970
287+ }
280288
281289 switch previousCompilationStatus {
282- // Using outOfDateBuildRecord.inputInfos[input.file]?.previousModTime
283- // has some inaccuracy.
284- // Use outOfDateBuildRecord.buildTime instead
285- case . upToDate where modDate < outOfDateBuildRecord. buildTime:
290+
291+ case . upToDate where datesMatch:
286292 reportIncrementalDecision ? ( " May skip current input: " , input)
287293 return nil
288294
You can’t perform that action at this time.
0 commit comments