[llvm] r211393 - Fix some -Wsign-compare fallout from changing container count member functions to return unsigned instead of bool.
David Blaikie
dblaikie at gmail.com
Fri Jun 20 12:54:14 PDT 2014
Author: dblaikie
Date: Fri Jun 20 14:54:13 2014
New Revision: 211393
URL: http://llvm.org/viewvc/llvm-project?rev=211393&view=rev
Log:
Fix some -Wsign-compare fallout from changing container count member functions to return unsigned instead of bool.
Modified:
llvm/trunk/unittests/ADT/DenseMapTest.cpp
llvm/trunk/unittests/ADT/DenseSetTest.cpp
llvm/trunk/unittests/IR/ValueMapTest.cpp
Modified: llvm/trunk/unittests/ADT/DenseMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/DenseMapTest.cpp?rev=211393&r1=211392&r2=211393&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/DenseMapTest.cpp (original)
+++ llvm/trunk/unittests/ADT/DenseMapTest.cpp Fri Jun 20 14:54:13 2014
@@ -345,7 +345,7 @@ TEST(DenseMapCustomTest, FindAsTest) {
EXPECT_EQ(3u, map.size());
// Normal lookup tests
- EXPECT_EQ(1, map.count(1));
+ EXPECT_EQ(1u, map.count(1));
EXPECT_EQ(1u, map.find(0)->second);
EXPECT_EQ(2u, map.find(1)->second);
EXPECT_EQ(3u, map.find(2)->second);
Modified: llvm/trunk/unittests/ADT/DenseSetTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/DenseSetTest.cpp?rev=211393&r1=211392&r2=211393&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/DenseSetTest.cpp (original)
+++ llvm/trunk/unittests/ADT/DenseSetTest.cpp Fri Jun 20 14:54:13 2014
@@ -24,7 +24,7 @@ TEST_F(DenseSetTest, DoubleEntrySetTest)
set.insert(0);
set.insert(1);
// Original failure was an infinite loop in this call:
- EXPECT_EQ(0, set.count(2));
+ EXPECT_EQ(0u, set.count(2));
}
}
Modified: llvm/trunk/unittests/IR/ValueMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ValueMapTest.cpp?rev=211393&r1=211392&r2=211393&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/ValueMapTest.cpp (original)
+++ llvm/trunk/unittests/IR/ValueMapTest.cpp Fri Jun 20 14:54:13 2014
@@ -48,13 +48,13 @@ TYPED_TEST(ValueMapTest, FollowsValue) {
ValueMap<TypeParam*, int> VM;
VM[this->BitcastV.get()] = 7;
EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
- EXPECT_EQ(0, VM.count(this->AddV.get()));
+ EXPECT_EQ(0u, VM.count(this->AddV.get()));
this->BitcastV->replaceAllUsesWith(this->AddV.get());
EXPECT_EQ(7, VM.lookup(this->AddV.get()));
- EXPECT_EQ(0, VM.count(this->BitcastV.get()));
+ EXPECT_EQ(0u, VM.count(this->BitcastV.get()));
this->AddV.reset();
- EXPECT_EQ(0, VM.count(this->AddV.get()));
- EXPECT_EQ(0, VM.count(this->BitcastV.get()));
+ EXPECT_EQ(0u, VM.count(this->AddV.get()));
+ EXPECT_EQ(0u, VM.count(this->BitcastV.get()));
EXPECT_EQ(0U, VM.size());
}
@@ -90,7 +90,7 @@ TYPED_TEST(ValueMapTest, OperationsWork)
EXPECT_EQ(this->AddV.get(), InsertResult1.first->first);
EXPECT_EQ(3, InsertResult1.first->second);
EXPECT_TRUE(InsertResult1.second);
- EXPECT_EQ(true, VM.count(this->AddV.get()));
+ EXPECT_EQ(1u, VM.count(this->AddV.get()));
std::pair<typename ValueMap<TypeParam*, int>::iterator, bool> InsertResult2 =
VM.insert(std::make_pair(this->AddV.get(), 5));
EXPECT_EQ(this->AddV.get(), InsertResult2.first->first);
@@ -169,7 +169,7 @@ TYPED_TEST(ValueMapTest, DefaultCollisio
VM[this->BitcastV.get()] = 7;
VM[this->AddV.get()] = 9;
this->BitcastV->replaceAllUsesWith(this->AddV.get());
- EXPECT_EQ(0, VM.count(this->BitcastV.get()));
+ EXPECT_EQ(0u, VM.count(this->BitcastV.get()));
EXPECT_EQ(9, VM.lookup(this->AddV.get()));
}
@@ -218,7 +218,7 @@ TYPED_TEST(ValueMapTest, NoFollowRAUW) {
ValueMap<TypeParam*, int, NoFollow<TypeParam*> > VM;
VM[this->BitcastV.get()] = 7;
EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
- EXPECT_EQ(0, VM.count(this->AddV.get()));
+ EXPECT_EQ(0u, VM.count(this->AddV.get()));
this->BitcastV->replaceAllUsesWith(this->AddV.get());
EXPECT_EQ(7, VM.lookup(this->BitcastV.get()));
EXPECT_EQ(0, VM.lookup(this->AddV.get()));
@@ -284,11 +284,11 @@ TYPED_TEST(ValueMapTest, SurvivesModific
// Now the ModifyingConfig can modify the Map inside a callback.
VM[this->BitcastV.get()] = 7;
this->BitcastV->replaceAllUsesWith(this->AddV.get());
- EXPECT_FALSE(VM.count(this->BitcastV.get()));
- EXPECT_FALSE(VM.count(this->AddV.get()));
+ EXPECT_EQ(0u, VM.count(this->BitcastV.get()));
+ EXPECT_EQ(0u, VM.count(this->AddV.get()));
VM[this->AddV.get()] = 7;
this->AddV.reset();
- EXPECT_FALSE(VM.count(this->AddV.get()));
+ EXPECT_EQ(0u, VM.count(this->AddV.get()));
}
}
More information about the llvm-commits
mailing list