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
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index b112f02..4b32515 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -284,7 +284,7 @@
 
   NativeObjectCache Cache;
   if (!CacheDir.empty())
-    Cache = localCache(CacheDir, AddFile);
+    Cache = check(localCache(CacheDir, AddFile), "failed to create cache");
 
   check(Lto.run(AddStream, Cache), "LTO::run failed");
 }