aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/Transforms/ObjCARC/BlotMapVector.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Transforms/ObjCARC/BlotMapVector.h')
-rw-r--r--contrib/llvm/lib/Transforms/ObjCARC/BlotMapVector.h34
1 files changed, 22 insertions, 12 deletions
diff --git a/contrib/llvm/lib/Transforms/ObjCARC/BlotMapVector.h b/contrib/llvm/lib/Transforms/ObjCARC/BlotMapVector.h
index 9c5cf6f5f5ab..5518b49c4095 100644
--- a/contrib/llvm/lib/Transforms/ObjCARC/BlotMapVector.h
+++ b/contrib/llvm/lib/Transforms/ObjCARC/BlotMapVector.h
@@ -1,4 +1,4 @@
-//===- BlotMapVector.h - A MapVector with the blot operation -*- C++ -*----===//
+//===- BlotMapVector.h - A MapVector with the blot operation ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,30 +7,29 @@
//
//===----------------------------------------------------------------------===//
+#ifndef LLVM_LIB_TRANSFORMS_OBJCARC_BLOTMAPVECTOR_H
+#define LLVM_LIB_TRANSFORMS_OBJCARC_BLOTMAPVECTOR_H
+
#include "llvm/ADT/DenseMap.h"
-#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <utility>
#include <vector>
namespace llvm {
+
/// \brief An associative container with fast insertion-order (deterministic)
/// iteration over its elements. Plus the special blot operation.
template <class KeyT, class ValueT> class BlotMapVector {
/// Map keys to indices in Vector.
- typedef DenseMap<KeyT, size_t> MapTy;
+ using MapTy = DenseMap<KeyT, size_t>;
MapTy Map;
- typedef std::vector<std::pair<KeyT, ValueT>> VectorTy;
/// Keys and values.
+ using VectorTy = std::vector<std::pair<KeyT, ValueT>>;
VectorTy Vector;
public:
- typedef typename VectorTy::iterator iterator;
- typedef typename VectorTy::const_iterator const_iterator;
- iterator begin() { return Vector.begin(); }
- iterator end() { return Vector.end(); }
- const_iterator begin() const { return Vector.begin(); }
- const_iterator end() const { return Vector.end(); }
-
#ifdef EXPENSIVE_CHECKS
~BlotMapVector() {
assert(Vector.size() >= Map.size()); // May differ due to blotting.
@@ -46,6 +45,14 @@ public:
}
#endif
+ using iterator = typename VectorTy::iterator;
+ using const_iterator = typename VectorTy::const_iterator;
+
+ iterator begin() { return Vector.begin(); }
+ iterator end() { return Vector.end(); }
+ const_iterator begin() const { return Vector.begin(); }
+ const_iterator end() const { return Vector.end(); }
+
ValueT &operator[](const KeyT &Arg) {
std::pair<typename MapTy::iterator, bool> Pair =
Map.insert(std::make_pair(Arg, size_t(0)));
@@ -105,4 +112,7 @@ public:
return Map.empty();
}
};
-} //
+
+} // end namespace llvm
+
+#endif // LLVM_LIB_TRANSFORMS_OBJCARC_BLOTMAPVECTOR_H