From 327db23b6642499fab917014a4c9934c1649e120 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 13 Jul 2019 09:28:33 +0000 Subject: [Object] isNotObjectErrorInvalidFileType: simplify llvm-svn: 365997 --- llvm/lib/Object/Error.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'llvm/lib/Object/Error.cpp') diff --git a/llvm/lib/Object/Error.cpp b/llvm/lib/Object/Error.cpp index ab10d23036a..010c5b42dac 100644 --- a/llvm/lib/Object/Error.cpp +++ b/llvm/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)); + }); } -- cgit v1.2.3