Skip to content

Commit 117cfa6

Browse files
authored
[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 #118673 (comment)
1 parent ce77719 commit 117cfa6

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lldb/unittests/TestingSupport/Host/SocketTestUtilities.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ bool lldb_private::HostSupportsLocalhostToIPv4() {
122122

123123
auto addresses = SocketAddress::GetAddressInfo(
124124
"localhost", nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
125-
return std::find_if(addresses.begin(), addresses.end(),
126-
[](SocketAddress &addr) {
127-
return addr.GetFamily() == AF_INET;
128-
}) != addresses.end();
125+
return llvm::any_of(addresses, [](const SocketAddress &addr) {
126+
return addr.GetFamily() == AF_INET;
127+
});
129128
}
130129

131130
bool lldb_private::HostSupportsLocalhostToIPv6() {
@@ -134,10 +133,9 @@ bool lldb_private::HostSupportsLocalhostToIPv6() {
134133

135134
auto addresses = SocketAddress::GetAddressInfo(
136135
"localhost", nullptr, AF_UNSPEC, SOCK_STREAM, IPPROTO_TCP);
137-
return std::find_if(addresses.begin(), addresses.end(),
138-
[](SocketAddress &addr) {
139-
return addr.GetFamily() == AF_INET6;
140-
}) != addresses.end();
136+
return llvm::any_of(addresses, [](const SocketAddress &addr) {
137+
return addr.GetFamily() == AF_INET6;
138+
});
141139
}
142140

143141
llvm::Expected<std::string> lldb_private::GetLocalhostIP() {

0 commit comments

Comments
 (0)