summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
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.