summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/LTO')
-rw-r--r--llvm/lib/LTO/LTOModule.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index 409b9490233..4806f903bdf 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -105,8 +105,10 @@ LTOModule::createFromFile(LLVMContext &Context, const char *path,
TargetOptions options) {
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
MemoryBuffer::getFile(path);
- if (std::error_code EC = BufferOrErr.getError())
+ if (std::error_code EC = BufferOrErr.getError()) {
+ Context.emitError(EC.message());
return EC;
+ }
std::unique_ptr<MemoryBuffer> Buffer = std::move(BufferOrErr.get());
return makeLTOModule(Buffer->getMemBufferRef(), options, &Context);
}
@@ -123,8 +125,10 @@ LTOModule::createFromOpenFileSlice(LLVMContext &Context, int fd,
off_t offset, TargetOptions options) {
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
MemoryBuffer::getOpenFileSlice(fd, path, map_size, offset);
- if (std::error_code EC = BufferOrErr.getError())
+ if (std::error_code EC = BufferOrErr.getError()) {
+ Context.emitError(EC.message());
return EC;
+ }
std::unique_ptr<MemoryBuffer> Buffer = std::move(BufferOrErr.get());
return makeLTOModule(Buffer->getMemBufferRef(), options, &Context);
}
@@ -158,8 +162,10 @@ parseBitcodeFileImpl(MemoryBufferRef Buffer, LLVMContext &Context,
// Find the buffer.
ErrorOr<MemoryBufferRef> MBOrErr =
IRObjectFile::findBitcodeInMemBuffer(Buffer);
- if (std::error_code EC = MBOrErr.getError())
+ if (std::error_code EC = MBOrErr.getError()) {
+ Context.emitError(EC.message());
return EC;
+ }
if (!ShouldBeLazy) {
// Parse the full file.
OpenPOWER on IntegriCloud