aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/MapVector.h
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-07-21 00:45:20 -0700
committerStephen Hines <srhines@google.com>2014-07-25 00:48:57 -0700
commitcd81d94322a39503e4a3e87b6ee03d4fcb3465fb (patch)
tree81b7dd2bb4370a392f31d332a566c903b5744764 /include/llvm/ADT/MapVector.h
parent0c5f13c0c4499eaf42ab5e9e2ceabd4e20e36861 (diff)
downloadexternal_llvm-cd81d94322a39503e4a3e87b6ee03d4fcb3465fb.zip
external_llvm-cd81d94322a39503e4a3e87b6ee03d4fcb3465fb.tar.gz
external_llvm-cd81d94322a39503e4a3e87b6ee03d4fcb3465fb.tar.bz2
Update LLVM for rebase to r212749.
Includes a cherry-pick of: r212948 - fixes a small issue with atomic calls Change-Id: Ib97bd980b59f18142a69506400911a6009d9df18
Diffstat (limited to 'include/llvm/ADT/MapVector.h')
-rw-r--r--include/llvm/ADT/MapVector.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/llvm/ADT/MapVector.h b/include/llvm/ADT/MapVector.h
index 7fd1570..2eae22c 100644
--- a/include/llvm/ADT/MapVector.h
+++ b/include/llvm/ADT/MapVector.h
@@ -29,7 +29,7 @@ template<typename KeyT, typename ValueT,
typename MapType = llvm::DenseMap<KeyT, unsigned>,
typename VectorType = std::vector<std::pair<KeyT, ValueT> > >
class MapVector {
- typedef typename VectorType::size_type SizeType;
+ typedef typename VectorType::size_type size_type;
MapType Map;
VectorType Vector;
@@ -38,7 +38,7 @@ public:
typedef typename VectorType::iterator iterator;
typedef typename VectorType::const_iterator const_iterator;
- SizeType size() const {
+ size_type size() const {
return Vector.size();
}
@@ -100,7 +100,7 @@ public:
return std::make_pair(begin() + I, false);
}
- unsigned count(const KeyT &Key) const {
+ size_type count(const KeyT &Key) const {
typename MapType::const_iterator Pos = Map.find(Key);
return Pos == Map.end()? 0 : 1;
}
@@ -123,6 +123,15 @@ public:
Map.erase(Pos);
Vector.pop_back();
}
+
+ /// \brief Remove the element given by Iterator.
+ /// Returns an iterator to the element following the one which was removed,
+ /// which may be end().
+ typename VectorType::iterator erase(typename VectorType::iterator Iterator) {
+ typename MapType::iterator MapIterator = Map.find(Iterator->first);
+ Map.erase(MapIterator);
+ return Vector.erase(Iterator);
+ }
};
}