From: Chris Lattner Date: Sun, 22 Jul 2007 20:08:01 +0000 (+0000) Subject: Disable the string map copy ctor and assignment operators, X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=c6402013c8767d5718d4c7ae5625969361182771;p=oota-llvm.git 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 --- diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h index cb1dd9f1329..72108e97e4f 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. };