Update the MemoryBuffer API to use ErrorOr.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212405 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-07-06 17:43:13 +00:00
parent 04e43e64a9
commit 7cba2a973f
35 changed files with 296 additions and 279 deletions

View File

@@ -83,8 +83,9 @@ ObjectFile::createObjectFile(std::unique_ptr<MemoryBuffer> &Object,
}
ErrorOr<ObjectFile *> ObjectFile::createObjectFile(StringRef ObjectPath) {
std::unique_ptr<MemoryBuffer> File;
if (std::error_code EC = MemoryBuffer::getFile(ObjectPath, File))
ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
MemoryBuffer::getFile(ObjectPath);
if (std::error_code EC = FileOrErr.getError())
return EC;
return createObjectFile(File);
return createObjectFile(FileOrErr.get());
}