Add methods to StringMap to erase entries by key.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52640 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2008-06-23 21:07:03 +00:00
parent 99ec779a93
commit 84701836bf

View File

@ -377,6 +377,20 @@ public:
V.Destroy(Allocator);
}
bool erase(const char *Key) {
iterator I = find(Key);
if (I == end()) return false;
erase(I);
return true;
}
bool erase(std::string Key) {
iterator I = find(Key);
if (I == end()) return false;
erase(I);
return true;
}
~StringMap() {
for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) {
if (I->Item && I->Item != getTombstoneVal())