1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

CachePruning: early exit if no path supplied

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266965
This commit is contained in:
Mehdi Amini 2016-04-21 06:43:45 +00:00
parent 3078624124
commit f35dd3b03b

View File

@ -33,8 +33,15 @@ static void writeTimestampFile(StringRef TimestampFile) {
/// Prune the cache of files that haven't been accessed in a long time.
bool CachePruning::prune() {
SmallString<128> TimestampFile(Path);
sys::path::append(TimestampFile, "llvmcache.timestamp");
if (Path.empty())
return false;
bool isPathDir;
if (sys::fs::is_directory(Path, isPathDir))
return false;
if (!isPathDir)
return false;
if (Expiration == 0 && PercentageOfAvailableSpace == 0) {
DEBUG(dbgs() << "No pruning settings set, exit early\n");
@ -43,6 +50,8 @@ bool CachePruning::prune() {
}
// Try to stat() the timestamp file.
SmallString<128> TimestampFile(Path);
sys::path::append(TimestampFile, "llvmcache.timestamp");
sys::fs::file_status FileStatus;
sys::TimeValue CurrentTime = sys::TimeValue::now();
if (sys::fs::status(TimestampFile, FileStatus)) {