Skip to content

Conversation

@ashgti
Copy link
Contributor

@ashgti ashgti commented Dec 8, 2024

This was suggested in a previous patch after the commit was already submitted.

Original suggestion #118673 (comment)

This was suggested in a previous patch after the commit was already submitted.
@ashgti ashgti requested a review from JDevlieghere as a code owner December 8, 2024 20:54
@ashgti ashgti requested a review from labath December 8, 2024 20:54
@llvmbot llvmbot added the lldb label Dec 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 8, 2024

@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)

Changes

This was suggested in a previous patch after the commit was already submitted.


Full diff: https://github.com/llvm/llvm-project/pull/119148.diff

1 Files Affected:

  • (modified) lldb/unittests/TestingSupport/Host/SocketTestUtilities.cpp (+6-8)
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() {

Copy link
Collaborator

@labath labath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat

@ashgti ashgti merged commit 117cfa6 into llvm:main Dec 9, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants