summaryrefslogtreecommitdiff
path: root/include/llvm/IR/ValueMap.h
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-16 19:46:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-16 19:46:52 +0000
commit6b3f41ed88e8e440e11a4fbf20b6600529f80049 (patch)
tree928b056f24a634d628c80238dbbf10d41b1a71d5 /include/llvm/IR/ValueMap.h
parentc46e6a5940c50058e00c0c5f9123fd82e338d29a (diff)
downloadsrc-test2-e60cb5ab119b9a563b017aa95a500a9455152421.tar.gz
src-test2-e60cb5ab119b9a563b017aa95a500a9455152421.zip
Diffstat (limited to 'include/llvm/IR/ValueMap.h')
-rw-r--r--include/llvm/IR/ValueMap.h42
1 files changed, 22 insertions, 20 deletions
diff --git a/include/llvm/IR/ValueMap.h b/include/llvm/IR/ValueMap.h
index 9648e1989f94..11d5823ee479 100644
--- a/include/llvm/IR/ValueMap.h
+++ b/include/llvm/IR/ValueMap.h
@@ -46,7 +46,6 @@ namespace llvm {
template<typename KeyT, typename ValueT, typename Config>
class ValueMapCallbackVH;
-
template<typename DenseMapT, typename KeyT>
class ValueMapIterator;
template<typename DenseMapT, typename KeyT>
@@ -57,7 +56,7 @@ class ValueMapConstIterator;
/// as possible with future versions of ValueMap.
template<typename KeyT, typename MutexT = sys::Mutex>
struct ValueMapConfig {
- typedef MutexT mutex_type;
+ using mutex_type = MutexT;
/// If FollowRAUW is true, the ValueMap will update mappings on RAUW. If it's
/// false, the ValueMap will leave the original mapping in place.
@@ -87,21 +86,21 @@ template<typename KeyT, typename ValueT, typename Config =ValueMapConfig<KeyT>>
class ValueMap {
friend class ValueMapCallbackVH<KeyT, ValueT, Config>;
- typedef ValueMapCallbackVH<KeyT, ValueT, Config> ValueMapCVH;
- typedef DenseMap<ValueMapCVH, ValueT, DenseMapInfo<ValueMapCVH>> MapT;
- typedef DenseMap<const Metadata *, TrackingMDRef> MDMapT;
- typedef typename Config::ExtraData ExtraData;
+ using ValueMapCVH = ValueMapCallbackVH<KeyT, ValueT, Config>;
+ using MapT = DenseMap<ValueMapCVH, ValueT, DenseMapInfo<ValueMapCVH>>;
+ using MDMapT = DenseMap<const Metadata *, TrackingMDRef>;
+ using ExtraData = typename Config::ExtraData;
+
MapT Map;
Optional<MDMapT> MDMap;
ExtraData Data;
-
bool MayMapMetadata = true;
public:
- typedef KeyT key_type;
- typedef ValueT mapped_type;
- typedef std::pair<KeyT, ValueT> value_type;
- typedef unsigned size_type;
+ using key_type = KeyT;
+ using mapped_type = ValueT;
+ using value_type = std::pair<KeyT, ValueT>;
+ using size_type = unsigned;
explicit ValueMap(unsigned NumInitBuckets = 64)
: Map(NumInitBuckets), Data() {}
@@ -132,8 +131,9 @@ public:
return Where->second.get();
}
- typedef ValueMapIterator<MapT, KeyT> iterator;
- typedef ValueMapConstIterator<MapT, KeyT> const_iterator;
+ using iterator = ValueMapIterator<MapT, KeyT>;
+ using const_iterator = ValueMapConstIterator<MapT, KeyT>;
+
inline iterator begin() { return iterator(Map.begin()); }
inline iterator end() { return iterator(Map.end()); }
inline const_iterator begin() const { return const_iterator(Map.begin()); }
@@ -244,8 +244,8 @@ class ValueMapCallbackVH final : public CallbackVH {
friend class ValueMap<KeyT, ValueT, Config>;
friend struct DenseMapInfo<ValueMapCallbackVH>;
- typedef ValueMap<KeyT, ValueT, Config> ValueMapT;
- typedef typename std::remove_pointer<KeyT>::type KeySansPointerT;
+ using ValueMapT = ValueMap<KeyT, ValueT, Config>;
+ using KeySansPointerT = typename std::remove_pointer<KeyT>::type;
ValueMapT *Map;
@@ -298,7 +298,7 @@ public:
template<typename KeyT, typename ValueT, typename Config>
struct DenseMapInfo<ValueMapCallbackVH<KeyT, ValueT, Config>> {
- typedef ValueMapCallbackVH<KeyT, ValueT, Config> VH;
+ using VH = ValueMapCallbackVH<KeyT, ValueT, Config>;
static inline VH getEmptyKey() {
return VH(DenseMapInfo<Value *>::getEmptyKey());
@@ -330,8 +330,8 @@ class ValueMapIterator :
public std::iterator<std::forward_iterator_tag,
std::pair<KeyT, typename DenseMapT::mapped_type>,
ptrdiff_t> {
- typedef typename DenseMapT::iterator BaseT;
- typedef typename DenseMapT::mapped_type ValueT;
+ using BaseT = typename DenseMapT::iterator;
+ using ValueT = typename DenseMapT::mapped_type;
BaseT I;
@@ -344,7 +344,9 @@ public:
struct ValueTypeProxy {
const KeyT first;
ValueT& second;
+
ValueTypeProxy *operator->() { return this; }
+
operator std::pair<KeyT, ValueT>() const {
return std::make_pair(first, second);
}
@@ -380,8 +382,8 @@ class ValueMapConstIterator :
public std::iterator<std::forward_iterator_tag,
std::pair<KeyT, typename DenseMapT::mapped_type>,
ptrdiff_t> {
- typedef typename DenseMapT::const_iterator BaseT;
- typedef typename DenseMapT::mapped_type ValueT;
+ using BaseT = typename DenseMapT::const_iterator;
+ using ValueT = typename DenseMapT::mapped_type;
BaseT I;