Convert a few methods to use ErrorOr.

It used to be inconvenient to mix ErrorOr and UniquePtr, but with c++11
they work OK together.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-06-23 20:41:02 +00:00
parent 0da818cdbb
commit 2da970364f
5 changed files with 19 additions and 21 deletions

View File

@@ -466,9 +466,9 @@ static void PrintFileSectionSizes(StringRef file) {
for (MachOUniversalBinary::object_iterator I = UB->begin_objects(),
E = UB->end_objects();
I != E; ++I) {
std::unique_ptr<ObjectFile> UO;
ErrorOr<std::unique_ptr<ObjectFile>> UO = I->getAsObjectFile();
std::unique_ptr<Archive> UA;
if (!I->getAsObjectFile(UO)) {
if (UO) {
if (ObjectFile *o = dyn_cast<ObjectFile>(&*UO.get())) {
MachOObjectFile *MachO = dyn_cast<MachOObjectFile>(o);
if (OutputFormat == sysv)