[llvm] 6d871eb - [llvm-profdata][unittest] Fix -Wsign-compare after D147740
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 18:05:04 PDT 2023
Author: Fangrui Song
Date: 2023-06-26T18:05:00-07:00
New Revision: 6d871eb956040387e6750d577d0fc2eb439b68a6
URL: https://github.com/llvm/llvm-project/commit/6d871eb956040387e6750d577d0fc2eb439b68a6
DIFF: https://github.com/llvm/llvm-project/commit/6d871eb956040387e6750d577d0fc2eb439b68a6.diff
LOG: [llvm-profdata][unittest] Fix -Wsign-compare after D147740
Added:
Modified:
llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp b/llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp
index d7fe15a33702f..f468560c075d8 100644
--- a/llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp
+++ b/llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp
@@ -114,7 +114,7 @@ TEST(MD5CollisionTest, TestCollision) {
ASSERT_FALSE(Reader->read());
std::vector<StringRef> &NameTable = *Reader->getNameTable();
- ASSERT_EQ(NameTable.size(), 2);
+ ASSERT_EQ(NameTable.size(), size_t(2));
StringRef S1 = NameTable[0];
StringRef S2 = NameTable[1];
ASSERT_NE(S1, S2);
@@ -131,7 +131,7 @@ TEST(MD5CollisionTest, TestCollision) {
ExpectedFS.addBodySamples(9, 0, 0);
SampleProfileMap &Profiles = Reader->getProfiles();
- EXPECT_EQ(Profiles.size(), 1);
+ EXPECT_EQ(Profiles.size(), size_t(1));
if (Profiles.size()) {
auto &[Hash, FS] = *Profiles.begin();
EXPECT_EQ(Hash, ExpectedHash);
@@ -141,7 +141,7 @@ TEST(MD5CollisionTest, TestCollision) {
// Inserting S2 again should fail, returning the existing sample unchanged.
auto [It1, Inserted1] = Profiles.try_emplace(S2, FunctionSamples());
EXPECT_FALSE(Inserted1);
- EXPECT_EQ(Profiles.size(), 1);
+ EXPECT_EQ(Profiles.size(), size_t(1));
if (Profiles.size()) {
auto &[Hash, FS] = *It1;
EXPECT_EQ(Hash, ExpectedHash);
@@ -157,7 +157,7 @@ TEST(MD5CollisionTest, TestCollision) {
auto [It2, Inserted2] = Profiles.try_emplace(S1, FS1);
EXPECT_TRUE(Inserted2);
- EXPECT_EQ(Profiles.size(), 1);
+ EXPECT_EQ(Profiles.size(), size_t(1));
if (Profiles.size()) {
auto &[Hash, FS] = *It2;
EXPECT_EQ(Hash, ExpectedHash);
More information about the llvm-commits
mailing list