summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/CachePruning.cpp
diff options
context:
space:
mode:
authorBen Dunbobbin <bd1976llvm@gmail.com>2017-12-22 18:32:15 +0000
committerBen Dunbobbin <bd1976llvm@gmail.com>2017-12-22 18:32:15 +0000
commitbb534b15a9959cdb6dc03a64151f68f1293f7a28 (patch)
tree3e721d406fb86cb01496834b4fa9c7a732347a3e /llvm/lib/Support/CachePruning.cpp
parent26d11ca4b07e9c81fdcf6d00a20d8041c05bd842 (diff)
downloadbcm5719-llvm-bb534b15a9959cdb6dc03a64151f68f1293f7a28.tar.gz
bcm5719-llvm-bb534b15a9959cdb6dc03a64151f68f1293f7a28.zip
[ThinLTO][CachePruning] explicitly disable pruning
In https://reviews.llvm.org/rL321077 and https://reviews.llvm.org/D41231 I fixed a regression in the c-api which prevented the pruning from being *effectively* disabled. However this approach, helpfully recommended by @labath, is cleaner. It is also nice to remove the weasel words about effectively disabling from the api comments. Differential Revision: https://reviews.llvm.org/D41497 llvm-svn: 321376
Diffstat (limited to 'llvm/lib/Support/CachePruning.cpp')
-rw-r--r--llvm/lib/Support/CachePruning.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Support/CachePruning.cpp b/llvm/lib/Support/CachePruning.cpp
index e1ad8024096..141573c2a1c 100644
--- a/llvm/lib/Support/CachePruning.cpp
+++ b/llvm/lib/Support/CachePruning.cpp
@@ -155,8 +155,7 @@ 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 =
- time_point_cast<decltype(Policy.Interval)>(system_clock::now());
+ const auto CurrentTime = 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.
@@ -166,13 +165,14 @@ bool llvm::pruneCache(StringRef Path, CachePruningPolicy Policy) {
return false;
}
} else {
+ if (!Policy.Interval)
+ return false;
if (Policy.Interval != seconds(0)) {
// Check whether the time stamp is older than our pruning interval.
// If not, do nothing.
- const auto TimeStampModTime = time_point_cast<decltype(Policy.Interval)>(
- FileStatus.getLastModificationTime());
+ const auto TimeStampModTime = FileStatus.getLastModificationTime();
auto TimeStampAge = CurrentTime - TimeStampModTime;
- if (TimeStampAge <= Policy.Interval) {
+ if (TimeStampAge <= *Policy.Interval) {
DEBUG(dbgs() << "Timestamp file too recent ("
<< duration_cast<seconds>(TimeStampAge).count()
<< "s old), do not prune.\n");
OpenPOWER on IntegriCloud