Skip to content

Commit 1f38b8a

Browse files
[memprof] Use DenseMap::contains (NFC) (llvm#90124)
This patch replaces count with contains, following the spirit of clang-tidy's readability-container-contains.
1 parent eb4a510 commit 1f38b8a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/unittests/ProfileData/MemProfTest.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ TEST(MemProf, FillsValue) {
179179

180180
// Check the memprof record for foo.
181181
const llvm::GlobalValue::GUID FooId = IndexedMemProfRecord::getGUID("foo");
182-
ASSERT_EQ(Records.count(FooId), 1U);
182+
ASSERT_TRUE(Records.contains(FooId));
183183
const MemProfRecord &Foo = Records[FooId];
184184
ASSERT_THAT(Foo.AllocSites, SizeIs(1));
185185
EXPECT_EQ(Foo.AllocSites[0].Info.getAllocCount(), 1U);
@@ -195,7 +195,7 @@ TEST(MemProf, FillsValue) {
195195

196196
// Check the memprof record for bar.
197197
const llvm::GlobalValue::GUID BarId = IndexedMemProfRecord::getGUID("bar");
198-
ASSERT_EQ(Records.count(BarId), 1U);
198+
ASSERT_TRUE(Records.contains(BarId));
199199
const MemProfRecord &Bar = Records[BarId];
200200
ASSERT_THAT(Bar.AllocSites, SizeIs(1));
201201
EXPECT_EQ(Bar.AllocSites[0].Info.getAllocCount(), 1U);
@@ -215,7 +215,7 @@ TEST(MemProf, FillsValue) {
215215

216216
// Check the memprof record for xyz.
217217
const llvm::GlobalValue::GUID XyzId = IndexedMemProfRecord::getGUID("xyz");
218-
ASSERT_EQ(Records.count(XyzId), 1U);
218+
ASSERT_TRUE(Records.contains(XyzId));
219219
const MemProfRecord &Xyz = Records[XyzId];
220220
ASSERT_THAT(Xyz.CallSites, SizeIs(1));
221221
ASSERT_THAT(Xyz.CallSites[0], SizeIs(2));
@@ -226,7 +226,7 @@ TEST(MemProf, FillsValue) {
226226

227227
// Check the memprof record for abc.
228228
const llvm::GlobalValue::GUID AbcId = IndexedMemProfRecord::getGUID("abc");
229-
ASSERT_EQ(Records.count(AbcId), 1U);
229+
ASSERT_TRUE(Records.contains(AbcId));
230230
const MemProfRecord &Abc = Records[AbcId];
231231
EXPECT_TRUE(Abc.AllocSites.empty());
232232
ASSERT_THAT(Abc.CallSites, SizeIs(1));

0 commit comments

Comments
 (0)