llvm.org GIT mirror llvm / 51ad607
[llvm-ar] Use failIfError/fail helpers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253141 91177308-0d34-0410-b5e6-96231b3b80d8 Davide Italiano 3 years ago
1 changed file(s) with 4 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
652652 ErrorOr> Buf =
653653 MemoryBuffer::getFile(ArchiveName, -1, false);
654654 std::error_code EC = Buf.getError();
655 if (EC && EC != errc::no_such_file_or_directory) {
656 errs() << ToolName << ": error opening '" << ArchiveName
657 << "': " << EC.message() << "!\n";
658 return 1;
659 }
655 if (EC && EC != errc::no_such_file_or_directory)
656 fail("error opening '" + ArchiveName + "': " + EC.message() + "!");
660657
661658 if (!EC) {
662659 object::Archive Archive(Buf.get()->getMemBufferRef(), EC);
663
664 if (EC) {
665 errs() << ToolName << ": error loading '" << ArchiveName
666 << "': " << EC.message() << "!\n";
667 return 1;
668 }
660 failIfError(EC,
661 "error loading '" + ArchiveName + "': " + EC.message() + "!");
669662 performOperation(Operation, &Archive, NewMembers);
670663 return 0;
671664 }