Skip to content

Commit 1cf5dde

Browse files
[DebugInfo] Use llvm::find_if (NFC) (#141521)
1 parent 9e8fa41 commit 1cf5dde

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,11 @@ void checkElementPropertiesClangCodeview(LVReader *Reader) {
135135
ASSERT_NE(Types, nullptr);
136136
EXPECT_EQ(Types->size(), 6u);
137137

138-
const auto BoolType =
139-
std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
140-
return elt->getName() == "bool";
141-
});
138+
const auto BoolType = llvm::find_if(
139+
*Types, [](const LVElement *elt) { return elt->getName() == "bool"; });
142140
ASSERT_NE(BoolType, Types->end());
143-
const auto IntType =
144-
std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
145-
return elt->getName() == "int";
146-
});
141+
const auto IntType = llvm::find_if(
142+
*Types, [](const LVElement *elt) { return elt->getName() == "int"; });
147143
ASSERT_NE(IntType, Types->end());
148144
EXPECT_EQ(static_cast<LVType *>(*BoolType)->getBitSize(), 8u);
149145
EXPECT_EQ(static_cast<LVType *>(*BoolType)->getStorageSizeInBytes(), 1u);
@@ -221,15 +217,11 @@ void checkElementPropertiesMsvcCodeview(LVReader *Reader) {
221217
ASSERT_NE(Types, nullptr);
222218
EXPECT_EQ(Types->size(), 8u);
223219

224-
const auto BoolType =
225-
std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
226-
return elt->getName() == "bool";
227-
});
220+
const auto BoolType = llvm::find_if(
221+
*Types, [](const LVElement *elt) { return elt->getName() == "bool"; });
228222
ASSERT_NE(BoolType, Types->end());
229-
const auto IntType =
230-
std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
231-
return elt->getName() == "int";
232-
});
223+
const auto IntType = llvm::find_if(
224+
*Types, [](const LVElement *elt) { return elt->getName() == "int"; });
233225
ASSERT_NE(IntType, Types->end());
234226
EXPECT_EQ(static_cast<LVType *>(*BoolType)->getBitSize(), 8u);
235227
EXPECT_EQ(static_cast<LVType *>(*BoolType)->getStorageSizeInBytes(), 1u);

llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,11 @@ void checkElementProperties(LVReader *Reader) {
132132
ASSERT_NE(Types, nullptr);
133133
EXPECT_EQ(Types->size(), 7u);
134134

135-
const auto BoolType =
136-
std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
137-
return elt->getName() == "bool";
138-
});
135+
const auto BoolType = llvm::find_if(
136+
*Types, [](const LVElement *elt) { return elt->getName() == "bool"; });
139137
ASSERT_NE(BoolType, Types->end());
140-
const auto IntType =
141-
std::find_if(Types->begin(), Types->end(), [](const LVElement *elt) {
142-
return elt->getName() == "int";
143-
});
138+
const auto IntType = llvm::find_if(
139+
*Types, [](const LVElement *elt) { return elt->getName() == "int"; });
144140
ASSERT_NE(IntType, Types->end());
145141
EXPECT_EQ(static_cast<LVType *>(*BoolType)->getBitSize(), 8u);
146142
EXPECT_EQ(static_cast<LVType *>(*BoolType)->getStorageSizeInBytes(), 1u);

0 commit comments

Comments
 (0)