[llvm] [DebugInfo] Use llvm::find_if (NFC) (PR #141521)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon May 26 13:03:17 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/141521

None

>From f622f37b71169dbe2296f622af6f712009a8e886 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 26 May 2025 11:38:13 -0700
Subject: [PATCH] [DebugInfo] Use llvm::find_if (NFC)

---
 .../LogicalView/CodeViewReaderTest.cpp        | 24 +++++++------------
 .../DebugInfo/LogicalView/DWARFReaderTest.cpp | 12 ++++------
 2 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp b/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
index d11a25f1a18dd..613a417db0f95 100644
--- a/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
+++ b/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
@@ -135,15 +135,11 @@ void checkElementPropertiesClangCodeview(LVReader *Reader) {
   ASSERT_NE(Types, nullptr);
   EXPECT_EQ(Types->size(), 6u);
 
-  const auto BoolType =
-      std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
-        return elt->getName() == "bool";
-      });
+  const auto BoolType = llvm::find_if(
+      *Types, [](const LVElement *elt) { return elt->getName() == "bool"; });
   ASSERT_NE(BoolType, Types->end());
-  const auto IntType =
-      std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
-        return elt->getName() == "int";
-      });
+  const auto IntType = llvm::find_if(
+      *Types, [](const LVElement *elt) { return elt->getName() == "int"; });
   ASSERT_NE(IntType, Types->end());
   EXPECT_EQ(static_cast<LVType *>(*BoolType)->getBitSize(), 8u);
   EXPECT_EQ(static_cast<LVType *>(*BoolType)->getStorageSizeInBytes(), 1u);
@@ -221,15 +217,11 @@ void checkElementPropertiesMsvcCodeview(LVReader *Reader) {
   ASSERT_NE(Types, nullptr);
   EXPECT_EQ(Types->size(), 8u);
 
-  const auto BoolType =
-      std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
-        return elt->getName() == "bool";
-      });
+  const auto BoolType = llvm::find_if(
+      *Types, [](const LVElement *elt) { return elt->getName() == "bool"; });
   ASSERT_NE(BoolType, Types->end());
-  const auto IntType =
-      std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
-        return elt->getName() == "int";
-      });
+  const auto IntType = llvm::find_if(
+      *Types, [](const LVElement *elt) { return elt->getName() == "int"; });
   ASSERT_NE(IntType, Types->end());
   EXPECT_EQ(static_cast<LVType *>(*BoolType)->getBitSize(), 8u);
   EXPECT_EQ(static_cast<LVType *>(*BoolType)->getStorageSizeInBytes(), 1u);
diff --git a/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp b/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
index 54a5bd400baf8..c409f24130d83 100644
--- a/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
+++ b/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
@@ -132,15 +132,11 @@ void checkElementProperties(LVReader *Reader) {
   ASSERT_NE(Types, nullptr);
   EXPECT_EQ(Types->size(), 7u);
 
-  const auto BoolType =
-      std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
-        return elt->getName() == "bool";
-      });
+  const auto BoolType = llvm::find_if(
+      *Types, [](const LVElement *elt) { return elt->getName() == "bool"; });
   ASSERT_NE(BoolType, Types->end());
-  const auto IntType =
-      std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
-        return elt->getName() == "int";
-      });
+  const auto IntType = llvm::find_if(
+      *Types, [](const LVElement *elt) { return elt->getName() == "int"; });
   ASSERT_NE(IntType, Types->end());
   EXPECT_EQ(static_cast<LVType *>(*BoolType)->getBitSize(), 8u);
   EXPECT_EQ(static_cast<LVType *>(*BoolType)->getStorageSizeInBytes(), 1u);



More information about the llvm-commits mailing list