summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTOModule.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-10-11 18:07:18 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-10-11 18:07:18 +0000
commit3500f5e3bf1c5818913d5b6a675f3cae3daee808 (patch)
treecc6d68d3faa110dcac2b952d14da8c5d27902ac7 /llvm/lib/LTO/LTOModule.cpp
parentf9c7f7fed4c8d1c39984debc754a16037b271781 (diff)
downloadbcm5719-llvm-3500f5e3bf1c5818913d5b6a675f3cae3daee808.tar.gz
bcm5719-llvm-3500f5e3bf1c5818913d5b6a675f3cae3daee808.zip
Convert the last uses of ErrorOr in include/llvm/Object.
llvm-svn: 315483
Diffstat (limited to 'llvm/lib/LTO/LTOModule.cpp')
-rw-r--r--llvm/lib/LTO/LTOModule.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index 3cc8b7d0e77..6a0fbb664da 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -60,7 +60,7 @@ LTOModule::~LTOModule() {}
/// isBitcodeFile - Returns 'true' if the file (or memory contents) is LLVM
/// bitcode.
bool LTOModule::isBitcodeFile(const void *Mem, size_t Length) {
- ErrorOr<MemoryBufferRef> BCData = IRObjectFile::findBitcodeInMemBuffer(
+ Expected<MemoryBufferRef> BCData = IRObjectFile::findBitcodeInMemBuffer(
MemoryBufferRef(StringRef((const char *)Mem, Length), "<mem>"));
return bool(BCData);
}
@@ -71,7 +71,7 @@ bool LTOModule::isBitcodeFile(StringRef Path) {
if (!BufferOrErr)
return false;
- ErrorOr<MemoryBufferRef> BCData = IRObjectFile::findBitcodeInMemBuffer(
+ Expected<MemoryBufferRef> BCData = IRObjectFile::findBitcodeInMemBuffer(
BufferOrErr.get()->getMemBufferRef());
return bool(BCData);
}
@@ -87,7 +87,7 @@ bool LTOModule::isThinLTO() {
bool LTOModule::isBitcodeForTarget(MemoryBuffer *Buffer,
StringRef TriplePrefix) {
- ErrorOr<MemoryBufferRef> BCOrErr =
+ Expected<MemoryBufferRef> BCOrErr =
IRObjectFile::findBitcodeInMemBuffer(Buffer->getMemBufferRef());
if (!BCOrErr)
return false;
@@ -100,7 +100,7 @@ bool LTOModule::isBitcodeForTarget(MemoryBuffer *Buffer,
}
std::string LTOModule::getProducerString(MemoryBuffer *Buffer) {
- ErrorOr<MemoryBufferRef> BCOrErr =
+ Expected<MemoryBufferRef> BCOrErr =
IRObjectFile::findBitcodeInMemBuffer(Buffer->getMemBufferRef());
if (!BCOrErr)
return "";
@@ -174,11 +174,11 @@ LTOModule::createInLocalContext(std::unique_ptr<LLVMContext> Context,
static ErrorOr<std::unique_ptr<Module>>
parseBitcodeFileImpl(MemoryBufferRef Buffer, LLVMContext &Context,
bool ShouldBeLazy) {
-
// Find the buffer.
- ErrorOr<MemoryBufferRef> MBOrErr =
+ Expected<MemoryBufferRef> MBOrErr =
IRObjectFile::findBitcodeInMemBuffer(Buffer);
- if (std::error_code EC = MBOrErr.getError()) {
+ if (Error E = MBOrErr.takeError()) {
+ std::error_code EC = errorToErrorCode(std::move(E));
Context.emitError(EC.message());
return EC;
}
OpenPOWER on IntegriCloud