1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[llvm-ar] Use failIfError/fail helpers.

llvm-svn: 253141
This commit is contained in:
Davide Italiano 2015-11-14 19:00:33 +00:00
parent 87f81cd4cc
commit fee337b602

View File

@ -653,20 +653,13 @@ static int performOperation(ArchiveOperation Operation,
ErrorOr<std::unique_ptr<MemoryBuffer>> Buf =
MemoryBuffer::getFile(ArchiveName, -1, false);
std::error_code EC = Buf.getError();
if (EC && EC != errc::no_such_file_or_directory) {
errs() << ToolName << ": error opening '" << ArchiveName
<< "': " << EC.message() << "!\n";
return 1;
}
if (EC && EC != errc::no_such_file_or_directory)
fail("error opening '" + ArchiveName + "': " + EC.message() + "!");
if (!EC) {
object::Archive Archive(Buf.get()->getMemBufferRef(), EC);
if (EC) {
errs() << ToolName << ": error loading '" << ArchiveName
<< "': " << EC.message() << "!\n";
return 1;
}
failIfError(EC,
"error loading '" + ArchiveName + "': " + EC.message() + "!");
performOperation(Operation, &Archive, NewMembers);
return 0;
}