summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm-c/lto.h8
-rw-r--r--llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h17
-rw-r--r--llvm/include/llvm/Support/CachePruning.h5
3 files changed, 15 insertions, 15 deletions
diff --git a/llvm/include/llvm-c/lto.h b/llvm/include/llvm-c/lto.h
index 0fc02f46f7a..55f3e46c45e 100644
--- a/llvm/include/llvm-c/lto.h
+++ b/llvm/include/llvm-c/lto.h
@@ -764,7 +764,7 @@ extern void thinlto_codegen_add_cross_referenced_symbol(thinlto_code_gen_t cg,
* To avoid filling the disk space, a few knobs are provided:
* - The pruning interval limits the frequency at which the garbage collector
* will try to scan the cache directory to prune expired entries.
- * Setting to a negative number applies the maximum interval.
+ * Setting to a negative number disables the pruning.
* - The pruning expiration time indicates to the garbage collector how old an
* entry needs to be to be removed.
* - Finally, the garbage collector can be instructed to prune the cache until
@@ -782,9 +782,9 @@ extern void thinlto_codegen_set_cache_dir(thinlto_code_gen_t cg,
const char *cache_dir);
/**
- * Sets the cache pruning interval (in seconds). A negative value sets the
- * maximum possible pruning interval. An unspecified default value will be
- * applied, and a value of 0 will be ignored.
+ * Sets the cache pruning interval (in seconds). A negative value disables the
+ * pruning. An unspecified default value will be applied, and a value of 0 will
+ * be ignored.
*
* \since LTO_API_VERSION=18
*/
diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
index b879c7882ee..d794535700e 100644
--- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -148,16 +148,15 @@ public:
/// incremental build.
void setCacheDir(std::string Path) { CacheOptions.Path = std::move(Path); }
- /// Cache policy: interval (seconds) between two prunes of the cache. A
- /// negative value sets the maximum possible pruning interval. A value
- /// of 0 will be ignored.
+ /// Cache policy: interval (seconds) between two prunes of the cache. Set to a
+ /// negative value 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 = Interval > 0 ? std::chrono::seconds(Interval)
- : std::chrono::seconds::max();
+ if (Interval == 0)
+ return;
+ if(Interval < 0)
+ CacheOptions.Policy.Interval.reset();
+ else
+ CacheOptions.Policy.Interval = std::chrono::seconds(Interval);
}
/// Cache policy: expiration (in seconds) for an entry.
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index c577e9b8b63..327c7df4570 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -27,8 +27,9 @@ template <typename T> class Expected;
struct CachePruningPolicy {
/// The pruning interval. This is intended to be used to avoid scanning the
/// directory too often. It does not impact the decision of which file to
- /// prune. A value of 0 forces the scan to occur.
- std::chrono::seconds Interval = std::chrono::seconds(1200);
+ /// prune. A value of 0 forces the scan to occur. A value of None disables
+ /// pruning.
+ llvm::Optional<std::chrono::seconds> Interval = std::chrono::seconds(1200);
/// The expiration for a file. When a file hasn't been accessed for Expiration
/// seconds, it is removed from the cache. A value of 0 disables the
OpenPOWER on IntegriCloud