aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-07-22 20:08:01 +0000
committerChris Lattner <sabre@nondot.org>2007-07-22 20:08:01 +0000
commitc6402013c8767d5718d4c7ae5625969361182771 (patch)
treee6e140db345d9b33d438c892b32aa1a110d9eda5 /include/llvm
parent53929871fb75c4215fbf1d8517f4def897adf80b (diff)
downloadexternal_llvm-c6402013c8767d5718d4c7ae5625969361182771.zip
external_llvm-c6402013c8767d5718d4c7ae5625969361182771.tar.gz
external_llvm-c6402013c8767d5718d4c7ae5625969361182771.tar.bz2
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
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/StringMap.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h
index cb1dd9f..72108e9 100644
--- a/include/llvm/ADT/StringMap.h
+++ b/include/llvm/ADT/StringMap.h
@@ -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.
};