[Lldb-commits] [lldb] 117cfa6 - [lldb] Improving unit test helpers by utilizing llvm helpers. (#119148)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 9 08:44:02 PST 2024
Author: John Harrison
Date: 2024-12-09T08:43:58-08:00
New Revision: 117cfa66ea6b1e307db0e8da43a6e9306cdaaca0
URL: https://github.com/llvm/llvm-project/commit/117cfa66ea6b1e307db0e8da43a6e9306cdaaca0
DIFF: https://github.com/llvm/llvm-project/commit/117cfa66ea6b1e307db0e8da43a6e9306cdaaca0.diff
LOG: [lldb] Improving unit test helpers by utilizing llvm helpers. (#119148)
This was suggested in a previous patch after the commit was already
submitted.
Original suggestion
https://github.com/llvm/llvm-project/pull/118673#discussion_r1872812959
Added:
Modified:
lldb/unittests/TestingSupport/Host/SocketTestUtilities.cpp
Removed:
################################################################################
diff --git a/lldb/unittests/TestingSupport/Host/SocketTestUtilities.cpp b/lldb/unittests/TestingSupport/Host/SocketTestUtilities.cpp
index 80545b8c533a03..72ecde845567f7 100644
--- a/lldb/unittests/TestingSupport/Host/SocketTestUtilities.cpp
+++ b/lldb/unittests/TestingSupport/Host/SocketTestUtilities.cpp
@@ -122,10 +122,9 @@ bool lldb_private::HostSupportsLocalhostToIPv4() {
auto addresses = SocketAddress::GetAddressInfo(
"localhost", nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
- return std::find_if(addresses.begin(), addresses.end(),
- [](SocketAddress &addr) {
- return addr.GetFamily() == AF_INET;
- }) != addresses.end();
+ return llvm::any_of(addresses, [](const SocketAddress &addr) {
+ return addr.GetFamily() == AF_INET;
+ });
}
bool lldb_private::HostSupportsLocalhostToIPv6() {
@@ -134,10 +133,9 @@ bool lldb_private::HostSupportsLocalhostToIPv6() {
auto addresses = SocketAddress::GetAddressInfo(
"localhost", nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
- return std::find_if(addresses.begin(), addresses.end(),
- [](SocketAddress &addr) {
- return addr.GetFamily() == AF_INET6;
- }) != addresses.end();
+ return llvm::any_of(addresses, [](const SocketAddress &addr) {
+ return addr.GetFamily() == AF_INET6;
+ });
}
llvm::Expected<std::string> lldb_private::GetLocalhostIP() {
More information about the lldb-commits
mailing list