summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOCodeGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/LTO/LTOCodeGenerator.cpp')
-rw-r--r--llvm/lib/LTO/LTOCodeGenerator.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 4b51166a755..335197a1906 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -236,13 +236,14 @@ const void* LTOCodeGenerator::compile(size_t* length,
delete NativeObjectFile;
// read .o file into memory buffer
- std::unique_ptr<MemoryBuffer> BuffPtr;
- if (std::error_code ec = MemoryBuffer::getFile(name, BuffPtr, -1, false)) {
- errMsg = ec.message();
+ ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
+ MemoryBuffer::getFile(name, -1, false);
+ if (std::error_code EC = BufferOrErr.getError()) {
+ errMsg = EC.message();
sys::fs::remove(NativeObjectPath);
return nullptr;
}
- NativeObjectFile = BuffPtr.release();
+ NativeObjectFile = BufferOrErr.get().release();
// remove temp files
sys::fs::remove(NativeObjectPath);
OpenPOWER on IntegriCloud