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
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();
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())
}
free(TheTable);
}
+private:
+ StringMap(const StringMap &); // FIXME: Implement.
+ void operator=(const StringMap &); // FIXME: Implement.
};