Return an ErrorOr<Binary *> from createBinary.
I did write a version returning ErrorOr<OwningPtr<Binary> >, but it is too cumbersome to use without std::move. I will keep the patch locally and submit when we switch to c++11. llvm-svn: 199326
This commit is contained in:
@@ -260,11 +260,12 @@ static void dumpInput(StringRef File) {
|
||||
}
|
||||
|
||||
// Attempt to open the binary.
|
||||
OwningPtr<Binary> Binary;
|
||||
if (error_code EC = createBinary(File, Binary)) {
|
||||
ErrorOr<Binary *> BinaryOrErr = createBinary(File);
|
||||
if (error_code EC = BinaryOrErr.getError()) {
|
||||
reportError(File, EC);
|
||||
return;
|
||||
}
|
||||
OwningPtr<Binary> Binary(BinaryOrErr.get());
|
||||
|
||||
if (Archive *Arc = dyn_cast<Archive>(Binary.get()))
|
||||
dumpArchive(Arc);
|
||||
|
||||
Reference in New Issue
Block a user