diff options
-rw-r--r-- | llvm/include/llvm/ADT/DenseMap.h | 11 | ||||
-rw-r--r-- | llvm/include/llvm/ADT/DenseSet.h | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index ce0c006cf2b..cb951815f83 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -51,6 +51,17 @@ struct DenseMapInfo<T*> { static bool isPod() { return true; } }; +// Provide DenseMapInfo for chars. +template<> struct DenseMapInfo<char> { + static inline char getEmptyKey() { return ~0; } + static inline char getTombstoneKey() { return ~0 - 1; } + static unsigned getHashValue(const char& Val) { return Val * 37; } + static bool isPod() { return true; } + static bool isEqual(const char &LHS, const char &RHS) { + return LHS == RHS; + } +}; + // Provide DenseMapInfo for unsigned ints. template<> struct DenseMapInfo<unsigned> { static inline unsigned getEmptyKey() { return ~0; } diff --git a/llvm/include/llvm/ADT/DenseSet.h b/llvm/include/llvm/ADT/DenseSet.h index 953c67d53eb..ce7344bc1f9 100644 --- a/llvm/include/llvm/ADT/DenseSet.h +++ b/llvm/include/llvm/ADT/DenseSet.h @@ -90,6 +90,13 @@ public: std::pair<iterator, bool> insert(const ValueT &V) { return TheMap.insert(std::make_pair(V, 0)); } + + // Range insertion of values. + template<typename InputIt> + void insert(InputIt I, InputIt E) { + for (; I != E; ++I) + insert(*I); + } }; } // end namespace llvm |