Author: Pavel Labath Date: 2020-04-28T13:35:07+02:00 New Revision: f07f2cee9b4e19df78a19c9b2b552e2e5ba9d478
URL: https://github.com/llvm/llvm-project/commit/f07f2cee9b4e19df78a19c9b2b552e2e5ba9d478 DIFF: https://github.com/llvm/llvm-project/commit/f07f2cee9b4e19df78a19c9b2b552e2e5ba9d478.diff LOG: [lldb/unittest] Adjust CheckIPSupport function to avoid double-consume of llvm::Error The problem caught by clang-tidy and reported by Tobias Bosch. Added: Modified: lldb/unittests/Host/SocketTestUtilities.cpp Removed: ################################################################################ diff --git a/lldb/unittests/Host/SocketTestUtilities.cpp b/lldb/unittests/Host/SocketTestUtilities.cpp index c56b5f7a7809..e2006b85115d 100644 --- a/lldb/unittests/Host/SocketTestUtilities.cpp +++ b/lldb/unittests/Host/SocketTestUtilities.cpp @@ -101,16 +101,19 @@ static bool CheckIPSupport(llvm::StringRef Proto, llvm::StringRef Addr) { "Creating a canary {0} TCP socket failed: {1}.", Proto, Err) .str(); - if (Err.isA<llvm::ECError>() && - errorToErrorCode(std::move(Err)) == - std::make_error_code(std::errc::address_not_available)) { + bool HasAddrNotAvail = false; + handleAllErrors(std::move(Err), [&](std::unique_ptr<llvm::ECError> ECErr) { + if (ECErr->convertToErrorCode() == + std::make_error_code(std::errc::address_not_available)) + HasAddrNotAvail = true; + }); + if (HasAddrNotAvail) { GTEST_LOG_(WARNING) << llvm::formatv( "Assuming the host does not support {0}. Skipping test.", Proto) .str(); return false; } - consumeError(std::move(Err)); GTEST_LOG_(WARNING) << "Continuing anyway. The test will probably fail."; return true; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits