summaryrefslogtreecommitdiff
path: root/include
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
commit5b5d262052b4f0380c1abbf028144354856b269c (patch)
tree2a1e0cec27de022ba2396529171ab4aed1c91601 /include
parent0b59f4695fff5296c0fbc16e954d312d9bb304fe (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321077 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/LTO/legacy/ThinLTOCodeGenerator.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
index 14f0c48266f..2c842ecf96a 100644
--- a/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ b/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -151,8 +151,12 @@ public:
/// Cache policy: interval (seconds) between two prune of the cache. Set to a
/// negative value (default) to disable pruning. A value of 0 will be ignored.
void setCachePruningInterval(int Interval) {
+ static_assert(std::is_same<decltype(CacheOptions.Policy.Interval),
+ std::chrono::seconds>::value,
+ "ensure same types to avoid risk of overflow");
if (Interval)
- CacheOptions.Policy.Interval = std::chrono::seconds(Interval);
+ CacheOptions.Policy.Interval = Interval > 0 ? std::chrono::seconds(Interval)
+ : std::chrono::seconds::max();
}
/// Cache policy: expiration (in seconds) for an entry.