summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/Caching.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-03-02 02:02:38 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-03-02 02:02:38 +0000
commitab76a19afb14a4f3330ebc33fddb89db6e7f6ef9 (patch)
treebd7432f3210d093552d82298b35acb9ee94880d2 /llvm/lib/LTO/Caching.cpp
parent2f75ad4e519091d16f3f4d373f5b64d263c9b149 (diff)
downloadbcm5719-llvm-ab76a19afb14a4f3330ebc33fddb89db6e7f6ef9.tar.gz
bcm5719-llvm-ab76a19afb14a4f3330ebc33fddb89db6e7f6ef9.zip
LTO: When creating a local cache, create the cache directory if it does not already exist.
Differential Revision: https://reviews.llvm.org/D30519 llvm-svn: 296726
Diffstat (limited to 'llvm/lib/LTO/Caching.cpp')
-rw-r--r--llvm/lib/LTO/Caching.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/LTO/Caching.cpp b/llvm/lib/LTO/Caching.cpp
index f635369df8d..fc898c49998 100644
--- a/llvm/lib/LTO/Caching.cpp
+++ b/llvm/lib/LTO/Caching.cpp
@@ -46,8 +46,11 @@ static void commitEntry(StringRef TempFilename, StringRef EntryPath) {
}
}
-NativeObjectCache lto::localCache(StringRef CacheDirectoryPath,
- AddFileFn AddFile) {
+Expected<NativeObjectCache> lto::localCache(StringRef CacheDirectoryPath,
+ AddFileFn AddFile) {
+ if (std::error_code EC = sys::fs::create_directories(CacheDirectoryPath))
+ return errorCodeToError(EC);
+
return [=](unsigned Task, StringRef Key) -> AddStreamFn {
// First, see if we have a cache hit.
SmallString<64> EntryPath;
OpenPOWER on IntegriCloud