[PATCH] D54826: [Support/FileSystem] Add sub-second precision for atime/mtime of sys::fs::file_status on unix platforms

Argyrios Kyrtzidis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 25 11:41:04 PST 2018


akyrtzi added a comment.

> The general changes to the support libraries are usually facilitated because of missing functionality that is required somewhere else and it being the most logical place to add it. If so please attach related revisions to this one (through "Edit Related Revisions") so it's more clear why this was added

There have been enhancements to file_status that added more info without the requirement you stated (attach related revisions to this one), like:
https://reviews.llvm.org/D31110
https://reviews.llvm.org/D18456

This patch makes no changes to the existing API so there's no specific place that I can point to, but it improves accuracy of *every* site that calls getLastModification() and uses its value for comparisons, in and out-of-tree. It addresses 'false-negatives' (mistakenly considering that the mod time did not change because the change happened within 1 second) and 'false-positives' (when considering same mod time as 'changed' so as to be conservative against sub-second changes).
For some examples:
https://github.com/apple/swift-clang/blob/95cdf7c9af0dc102a3fbda4ae1f6265026ff2e30/lib/Frontend/PrecompiledPreamble.cpp#L486
https://github.com/apple/swift-clang/blob/95cdf7c9af0dc102a3fbda4ae1f6265026ff2e30/lib/Driver/Driver.cpp#L1132
https://github.com/apple/swift-clang/blob/95cdf7c9af0dc102a3fbda4ae1f6265026ff2e30/lib/Driver/ToolChains/Clang.cpp#L2623
https://github.com/apple/swift-clang/blob/95cdf7c9af0dc102a3fbda4ae1f6265026ff2e30/lib/Serialization/ModuleManager.cpp#L156
https://github.com/apple/swift-clang/blob/95cdf7c9af0dc102a3fbda4ae1f6265026ff2e30/lib/Index/IndexUnitWriter.cpp#L252
https://github.com/apple/swift-clang/blob/95cdf7c9af0dc102a3fbda4ae1f6265026ff2e30/lib/DirectoryWatcher/DirectoryWatcher-linux.inc.h#L33

Apart from improving accuracy of mod time comparisons inside clang and its libraries themselves, mod times originating from clang libraries get reported up to our indexing system where we could take advantage of sub-second accuracy, for the same kind of benefits.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54826/new/

https://reviews.llvm.org/D54826





More information about the llvm-commits mailing list