[llvm-commits] [llvm] r40395 - /llvm/trunk/include/llvm/ADT/StringMap.h
Chris Lattner
sabre at nondot.org
Sun Jul 22 13:08:01 PDT 2007
Author: lattner
Date: Sun Jul 22 15:08:01 2007
New Revision: 40395
URL: http://llvm.org/viewvc/llvm-project?rev=40395&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/ADT/StringMap.h
Modified: llvm/trunk/include/llvm/ADT/StringMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=40395&r1=40394&r2=40395&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringMap.h (original)
+++ llvm/trunk/include/llvm/ADT/StringMap.h Sun Jul 22 15:08:01 2007
@@ -55,7 +55,13 @@
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 @@
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 @@
}
free(TheTable);
}
+private:
+ StringMap(const StringMap &); // FIXME: Implement.
+ void operator=(const StringMap &); // FIXME: Implement.
};
More information about the llvm-commits
mailing list