* Added unittests for StringMap

* Fixed but in StringMap::clear()
* Removed trailing whitespace

Original patch by Talin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61914 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Misha Brukman
2009-01-08 04:48:20 +00:00
parent 2ec78c4a63
commit 8bb5e99013
2 changed files with 193 additions and 2 deletions

View File

@@ -336,7 +336,7 @@ public:
// clear - Empties out the StringMap
void clear() {
if (empty()) return;
// Zap all values, resetting the keys back to non-present (not tombstone),
// which is safe because we're removing all elements.
for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) {
@@ -345,6 +345,8 @@ public:
I->Item = 0;
}
}
NumItems = 0;
}
/// GetOrCreateValue - Look up the specified key in the table. If a value
@@ -421,7 +423,7 @@ protected:
StringMapImpl::ItemBucket *Ptr;
public:
typedef StringMapEntry<ValueTy> value_type;
explicit StringMapConstIterator(StringMapImpl::ItemBucket *Bucket,
bool NoAdvance = false)
: Ptr(Bucket) {