[llvm] r253141 - [llvm-ar] Use failIfError/fail helpers.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 14 11:00:33 PST 2015
Author: davide
Date: Sat Nov 14 13:00:33 2015
New Revision: 253141
URL: http://llvm.org/viewvc/llvm-project?rev=253141&view=rev
Log:
[llvm-ar] Use failIfError/fail helpers.
Modified:
llvm/trunk/tools/llvm-ar/llvm-ar.cpp
Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=253141&r1=253140&r2=253141&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Sat Nov 14 13:00:33 2015
@@ -653,20 +653,13 @@ static int performOperation(ArchiveOpera
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;
}
More information about the llvm-commits
mailing list