aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ADT
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2013-02-19 18:26:07 +0000
committerDouglas Gregor <dgregor@apple.com>2013-02-19 18:26:07 +0000
commit1f1713ff7a53c9c491c59886984f6a0534ce3630 (patch)
treec45abfb5e9ff2378d8a45abab4dd31fb8f64fdac /include/llvm/ADT
parent383c6fc458ebd2bb7748483de56a97b68f3a9f2d (diff)
Remove my bogus MapVector::erase() with a narrower ::pop_back(), and add a unit test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r--include/llvm/ADT/MapVector.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/include/llvm/ADT/MapVector.h b/include/llvm/ADT/MapVector.h
index 405fc43978..f6fcb0888d 100644
--- a/include/llvm/ADT/MapVector.h
+++ b/include/llvm/ADT/MapVector.h
@@ -119,14 +119,11 @@ public:
(Vector.begin() + Pos->second);
}
- /// \brief Erase entry with the given key.
- void erase(const KeyT &key) {
- typename MapType::iterator Pos = Map.find(key);
- if (Pos == Map.end())
- return;
-
- Vector.erase(Vector.begin() + Pos->second);
+ /// \brief Remove the last element from the vector.
+ void pop_back() {
+ typename MapType::iterator Pos = Map.find(Vector.back().first);
Map.erase(Pos);
+ Vector.pop_back();
}
};