[llvm-commits] [llvm] r110549 - in /llvm/trunk: include/llvm/ADT/ValueMap.h unittests/ADT/ValueMapTest.cpp
Duncan Sands
baldrick at free.fr
Sun Aug 8 05:57:49 PDT 2010
Author: baldrick
Date: Sun Aug 8 07:57:48 2010
New Revision: 110549
URL: http://llvm.org/viewvc/llvm-project?rev=110549&view=rev
Log:
Remove the ValueMap copy constructor. It's not used anywhere,
and removing it catches the mistake of passing a ValueMap by
copy rather than by reference.
Modified:
llvm/trunk/include/llvm/ADT/ValueMap.h
llvm/trunk/unittests/ADT/ValueMapTest.cpp
Modified: llvm/trunk/include/llvm/ADT/ValueMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ValueMap.h?rev=110549&r1=110548&r2=110549&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ValueMap.h (original)
+++ llvm/trunk/include/llvm/ADT/ValueMap.h Sun Aug 8 07:57:48 2010
@@ -82,18 +82,12 @@
typedef typename Config::ExtraData ExtraData;
MapT Map;
ExtraData Data;
+ ValueMap(const ValueMap&); // DO NOT IMPLEMENT
public:
typedef KeyT key_type;
typedef ValueT mapped_type;
typedef std::pair<KeyT, ValueT> value_type;
- ValueMap(const ValueMap& Other) : Map(Other.Map), Data(Other.Data) {
- // Each ValueMapCVH key contains a pointer to the containing ValueMap.
- // The keys in the new map need to point to the new map, not Other.
- for (typename MapT::iterator I = Map.begin(), E = Map.end(); I != E; ++I)
- I->first.Map = this;
- }
-
explicit ValueMap(unsigned NumInitBuckets = 64)
: Map(NumInitBuckets), Data() {}
explicit ValueMap(const ExtraData &Data, unsigned NumInitBuckets = 64)
Modified: llvm/trunk/unittests/ADT/ValueMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/ValueMapTest.cpp?rev=110549&r1=110548&r2=110549&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/ValueMapTest.cpp (original)
+++ llvm/trunk/unittests/ADT/ValueMapTest.cpp Sun Aug 8 07:57:48 2010
@@ -39,15 +39,6 @@
typedef ::testing::Types<Value, Instruction, const Instruction> KeyTypes;
TYPED_TEST_CASE(ValueMapTest, KeyTypes);
-TYPED_TEST(ValueMapTest, CopyConstructor) {
- ValueMap<TypeParam*, int> VM1;
- VM1[this->AddV.get()] = 7;
- ValueMap<TypeParam*, int> VM2(VM1);
- this->AddV.reset();
- EXPECT_TRUE(VM1.empty());
- EXPECT_TRUE(VM2.empty());
-}
-
TYPED_TEST(ValueMapTest, Null) {
ValueMap<TypeParam*, int> VM1;
VM1[NULL] = 7;
More information about the llvm-commits
mailing list