Disable the string map copy ctor and assignment operators,

they don't do the right thing.  

Implement StringMap::erase.

Fix a nasty bug in the default ctor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40395 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-07-22 20:08:01 +00:00
parent 53929871fb
commit c6402013c8

View File

@ -55,7 +55,13 @@ protected:
unsigned NumTombstones;
unsigned ItemSize;
protected:
StringMapImpl(unsigned itemSize) : ItemSize(itemSize) { init(16); }
StringMapImpl(unsigned itemSize) : ItemSize(itemSize) {
// Initialize the map with zero buckets to allocation.
TheTable = 0;
NumBuckets = 0;
NumItems = 0;
NumTombstones = 0;
}
StringMapImpl(unsigned InitSize, unsigned ItemSize);
void RehashTable();
@ -274,6 +280,12 @@ public:
RemoveKey(KeyValue);
}
void erase(iterator I) {
MapEntryTy &V = *I;
remove(&V);
V.Destroy(Allocator);
}
~StringMap() {
for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) {
if (I->Item && I->Item != getTombstoneVal())
@ -281,6 +293,9 @@ public:
}
free(TheTable);
}
private:
StringMap(const StringMap &); // FIXME: Implement.
void operator=(const StringMap &); // FIXME: Implement.
};