diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-10-03 00:44:21 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-10-03 00:44:21 +0000 |
commit | d5fc37cc887b618c0076a9e7ae66e329d382417e (patch) | |
tree | d6672a0ea6269d6c2af166ba6225015c428da2e9 /llvm/lib/LTO/Caching.cpp | |
parent | 67fbb351e37f0207ba2d200750a2c61491ae81e6 (diff) | |
download | bcm5719-llvm-d5fc37cc887b618c0076a9e7ae66e329d382417e.tar.gz bcm5719-llvm-d5fc37cc887b618c0076a9e7ae66e329d382417e.zip |
LTO: Improve error reporting when adding a cache entry.
Move error handling code next to the code that returns the error,
and change the error message in order to distinguish it from a similar
error message elsewhere in this file.
llvm-svn: 314745
Diffstat (limited to 'llvm/lib/LTO/Caching.cpp')
-rw-r--r-- | llvm/lib/LTO/Caching.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/LTO/Caching.cpp b/llvm/lib/LTO/Caching.cpp index 98360f7e9e9..1708ab4c5c7 100644 --- a/llvm/lib/LTO/Caching.cpp +++ b/llvm/lib/LTO/Caching.cpp @@ -66,15 +66,17 @@ Expected<NativeObjectCache> lto::localCache(StringRef CacheDirectoryPath, // Open the file first to avoid racing with a cache pruner. ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr = MemoryBuffer::getFile(TempFilename); + if (!MBOrErr) + report_fatal_error(Twine("Failed to open new cache file ") + + TempFilename + ": " + + MBOrErr.getError().message() + "\n"); // This is atomic on POSIX systems. if (auto EC = sys::fs::rename(TempFilename, EntryPath)) report_fatal_error(Twine("Failed to rename temporary file ") + - TempFilename + ": " + EC.message() + "\n"); + TempFilename + " to " + EntryPath + ": " + + EC.message() + "\n"); - if (!MBOrErr) - report_fatal_error(Twine("Failed to open cache file ") + EntryPath + - ": " + MBOrErr.getError().message() + "\n"); AddBuffer(Task, std::move(*MBOrErr), EntryPath); } }; |