From 3850f5cedad95e6062671d66b08e1a29e7d5e20f Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Sun, 8 Aug 2010 12:57:48 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110549 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/ValueMap.h | 8 +------- unittests/ADT/ValueMapTest.cpp | 9 --------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/llvm/ADT/ValueMap.h b/include/llvm/ADT/ValueMap.h index f7560681097..181fe71e370 100644 --- a/include/llvm/ADT/ValueMap.h +++ b/include/llvm/ADT/ValueMap.h @@ -82,18 +82,12 @@ class ValueMap { 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 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) diff --git a/unittests/ADT/ValueMapTest.cpp b/unittests/ADT/ValueMapTest.cpp index ff7c3b55b70..152e8eaaf1f 100644 --- a/unittests/ADT/ValueMapTest.cpp +++ b/unittests/ADT/ValueMapTest.cpp @@ -39,15 +39,6 @@ protected: typedef ::testing::Types KeyTypes; TYPED_TEST_CASE(ValueMapTest, KeyTypes); -TYPED_TEST(ValueMapTest, CopyConstructor) { - ValueMap VM1; - VM1[this->AddV.get()] = 7; - ValueMap VM2(VM1); - this->AddV.reset(); - EXPECT_TRUE(VM1.empty()); - EXPECT_TRUE(VM2.empty()); -} - TYPED_TEST(ValueMapTest, Null) { ValueMap VM1; VM1[NULL] = 7; -- 2.34.1