aboutsummaryrefslogtreecommitdiff
path: root/lib/Object/IRObjectFile.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-11-13 07:00:17 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-11-13 07:00:17 +0000
commitdead081fb270405507bf3a0a37413a3b54c1fbe0 (patch)
treeec848683502041e95c5c0579d0c93f0820032258 /lib/Object/IRObjectFile.cpp
parentb0c36f7ca74e027fbe55a8d1afc27cbaa30ddc21 (diff)
Bitcode: Change module reader functions to return an llvm::Expected.
Differential Revision: https://reviews.llvm.org/D26562 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object/IRObjectFile.cpp')
-rw-r--r--lib/Object/IRObjectFile.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp
index c2b4b289315..535ddb91935 100644
--- a/lib/Object/IRObjectFile.cpp
+++ b/lib/Object/IRObjectFile.cpp
@@ -310,18 +310,18 @@ ErrorOr<MemoryBufferRef> IRObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Ob
}
}
-ErrorOr<std::unique_ptr<IRObjectFile>>
+Expected<std::unique_ptr<IRObjectFile>>
llvm::object::IRObjectFile::create(MemoryBufferRef Object,
LLVMContext &Context) {
ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object);
if (!BCOrErr)
- return BCOrErr.getError();
+ return errorCodeToError(BCOrErr.getError());
- ErrorOr<std::unique_ptr<Module>> MOrErr =
+ Expected<std::unique_ptr<Module>> MOrErr =
getLazyBitcodeModule(*BCOrErr, Context,
/*ShouldLazyLoadMetadata*/ true);
- if (std::error_code EC = MOrErr.getError())
- return EC;
+ if (!MOrErr)
+ return MOrErr.takeError();
std::unique_ptr<Module> &M = MOrErr.get();
return llvm::make_unique<IRObjectFile>(BCOrErr.get(), std::move(M));