summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CachePruning.cpp
diff options
context:
space:
mode:
authorBen Dunbobbin <bd1976llvm@gmail.com>2017-12-19 14:42:38 +0000
committerBen Dunbobbin <bd1976llvm@gmail.com>2017-12-19 14:42:38 +0000
commit9ecb8b548c07551574a06ed19ce30b11d858df7a (patch)
treeb1d913b957cc186ed8a3c9b86957ef6af8abda77 /llvm/lib/Support/CachePruning.cpp
parent3feaf2a20748c75b2b055b730571ca26534830ae (diff)
downloadbcm5719-llvm-9ecb8b548c07551574a06ed19ce30b11d858df7a.tar.gz
bcm5719-llvm-9ecb8b548c07551574a06ed19ce30b11d858df7a.zip
[Support][CachePruning] Disable cache pruning regression fix
borked by: rL284966 (see: https://reviews.llvm.org/D25730). Previously, Interval was unsigned (see: CachePruning.h), replacing the type with std::chrono::seconds (which is signed) causes a regression in behaviour because the c-api intends negative values to translate to large positive intervals to *effectively* disable the pruning (see comments on: setCachePruningInterval()). Differential Revision: https://reviews.llvm.org/D41231 llvm-svn: 321077
Diffstat (limited to 'llvm/lib/Support/CachePruning.cpp')
-rw-r--r--llvm/lib/Support/CachePruning.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Support/CachePruning.cpp b/llvm/lib/Support/CachePruning.cpp
index 3e97c991f50..e1ad8024096 100644
--- a/llvm/lib/Support/CachePruning.cpp
+++ b/llvm/lib/Support/CachePruning.cpp
@@ -155,7 +155,8 @@ bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) {
SmallString<128> TimestampFile(Path);
sys::path::append(TimestampFile, "llvmcache.timestamp");
sys::fs::file_status FileStatus;
- const auto CurrentTime = system_clock::now();
+ const auto CurrentTime =
+ time_point_cast<decltype(Policy.Interval)>(system_clock::now());
if (auto EC = sys::fs::status(TimestampFile, FileStatus)) {
if (EC == errc::no_such_file_or_directory) {
// If the timestamp file wasn't there, create one now.
@@ -168,7 +169,8 @@ bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) {
if (Policy.Interval != seconds(0)) {
// Check whether the time stamp is older than our pruning interval.
// If not, do nothing.
- const auto TimeStampModTime = FileStatus.getLastModificationTime();
+ const auto TimeStampModTime = time_point_cast<decltype(Policy.Interval)>(
+ FileStatus.getLastModificationTime());
auto TimeStampAge = CurrentTime - TimeStampModTime;
if (TimeStampAge <= Policy.Interval) {
DEBUG(dbgs() << "Timestamp file too recent ("
OpenPOWER on IntegriCloud