[Lldb-commits] [lldb] [lldb] Improving unit test helpers by utilizing llvm helpers. (PR #119148)
via lldb-commits
lldb-commits at lists.llvm.org
Sun Dec 8 12:54:49 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: John Harrison (ashgti)
<details>
<summary>Changes</summary>
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
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() {
``````````
</details>
https://github.com/llvm/llvm-project/pull/119148
More information about the lldb-commits
mailing list