aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lli/lli.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lli/lli.cpp')
-rw-r--r--tools/lli/lli.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 4cde105..48828c1 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -285,8 +285,8 @@ public:
if (!getCacheFilename(ModuleID, CacheName))
return nullptr;
// Load the object from the cache filename
- std::unique_ptr<MemoryBuffer> IRObjectBuffer;
- MemoryBuffer::getFile(CacheName.c_str(), IRObjectBuffer, -1, false);
+ ErrorOr<std::unique_ptr<MemoryBuffer>> IRObjectBuffer =
+ MemoryBuffer::getFile(CacheName.c_str(), -1, false);
// If the file isn't there, that's OK.
if (!IRObjectBuffer)
return nullptr;
@@ -294,7 +294,7 @@ public:
// because the file has probably just been mmapped. Instead we make
// a copy. The filed-based buffer will be released when it goes
// out of scope.
- return MemoryBuffer::getMemBufferCopy(IRObjectBuffer->getBuffer());
+ return MemoryBuffer::getMemBufferCopy(IRObjectBuffer.get()->getBuffer());
}
private:
@@ -415,7 +415,7 @@ int main(int argc, char **argv, char * const *envp) {
// If not jitting lazily, load the whole bitcode file eagerly too.
if (NoLazyCompilation) {
- if (error_code EC = Mod->materializeAllPermanently()) {
+ if (std::error_code EC = Mod->materializeAllPermanently()) {
errs() << argv[0] << ": bitcode didn't read correctly.\n";
errs() << "Reason: " << EC.message() << "\n";
exit(1);
@@ -538,15 +538,15 @@ int main(int argc, char **argv, char * const *envp) {
}
for (unsigned i = 0, e = ExtraArchives.size(); i != e; ++i) {
- std::unique_ptr<MemoryBuffer> ArBuf;
- error_code ec;
- ec = MemoryBuffer::getFileOrSTDIN(ExtraArchives[i], ArBuf);
- if (ec) {
+ ErrorOr<std::unique_ptr<MemoryBuffer>> ArBuf =
+ MemoryBuffer::getFileOrSTDIN(ExtraArchives[i]);
+ if (!ArBuf) {
Err.print(argv[0], errs());
return 1;
}
- object::Archive *Ar = new object::Archive(ArBuf.release(), ec);
- if (ec || !Ar) {
+ std::error_code EC;
+ object::Archive *Ar = new object::Archive(std::move(ArBuf.get()), EC);
+ if (EC || !Ar) {
Err.print(argv[0], errs());
return 1;
}