From: Fangrui Song Date: Sat, 13 Jul 2019 09:28:33 +0000 (+0000) Subject: [Object] isNotObjectErrorInvalidFileType: simplify X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f60e624cb7ea7ef3584ac514f34938484260b7b;p=llvm [Object] isNotObjectErrorInvalidFileType: simplify git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365997 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Object/Error.cpp b/lib/Object/Error.cpp index ab10d23036a..010c5b42dac 100644 --- a/lib/Object/Error.cpp +++ b/lib/Object/Error.cpp @@ -78,18 +78,15 @@ const std::error_category &object::object_category() { } llvm::Error llvm::object::isNotObjectErrorInvalidFileType(llvm::Error Err) { - if (auto Err2 = - handleErrors(std::move(Err), [](std::unique_ptr M) -> Error { - // Try to handle 'M'. If successful, return a success value from - // the handler. - if (M->convertToErrorCode() == object_error::invalid_file_type) - return Error::success(); + return handleErrors(std::move(Err), [](std::unique_ptr M) -> Error { + // Try to handle 'M'. If successful, return a success value from + // the handler. + if (M->convertToErrorCode() == object_error::invalid_file_type) + return Error::success(); - // We failed to handle 'M' - return it from the handler. - // This value will be passed back from catchErrors and - // wind up in Err2, where it will be returned from this function. - return Error(std::move(M)); - })) - return Err2; - return Error::success(); + // We failed to handle 'M' - return it from the handler. + // This value will be passed back from catchErrors and + // wind up in Err2, where it will be returned from this function. + return Error(std::move(M)); + }); }