mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-10 16:24:04 +00:00
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
This commit is contained in:
parent
21d3eeb02b
commit
3850f5ceda
@ -82,18 +82,12 @@ class ValueMap {
|
|||||||
typedef typename Config::ExtraData ExtraData;
|
typedef typename Config::ExtraData ExtraData;
|
||||||
MapT Map;
|
MapT Map;
|
||||||
ExtraData Data;
|
ExtraData Data;
|
||||||
|
ValueMap(const ValueMap&); // DO NOT IMPLEMENT
|
||||||
public:
|
public:
|
||||||
typedef KeyT key_type;
|
typedef KeyT key_type;
|
||||||
typedef ValueT mapped_type;
|
typedef ValueT mapped_type;
|
||||||
typedef std::pair<KeyT, ValueT> value_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)
|
explicit ValueMap(unsigned NumInitBuckets = 64)
|
||||||
: Map(NumInitBuckets), Data() {}
|
: Map(NumInitBuckets), Data() {}
|
||||||
explicit ValueMap(const ExtraData &Data, unsigned NumInitBuckets = 64)
|
explicit ValueMap(const ExtraData &Data, unsigned NumInitBuckets = 64)
|
||||||
|
@ -39,15 +39,6 @@ protected:
|
|||||||
typedef ::testing::Types<Value, Instruction, const Instruction> KeyTypes;
|
typedef ::testing::Types<Value, Instruction, const Instruction> KeyTypes;
|
||||||
TYPED_TEST_CASE(ValueMapTest, 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) {
|
TYPED_TEST(ValueMapTest, Null) {
|
||||||
ValueMap<TypeParam*, int> VM1;
|
ValueMap<TypeParam*, int> VM1;
|
||||||
VM1[NULL] = 7;
|
VM1[NULL] = 7;
|
||||||
|
Loading…
Reference in New Issue
Block a user