diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index 7e8b8c5e02f..83edd640e33 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -108,12 +108,18 @@ public: return LookupBucketFor(Val, TheBucket); } - iterator find(const KeyT &Val) const { + iterator find(const KeyT &Val) { BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) return iterator(TheBucket, Buckets+NumBuckets); return end(); } + const_iterator find(const KeyT &Val) const { + BucketT *TheBucket; + if (LookupBucketFor(Val, TheBucket)) + return const_iterator(TheBucket, Buckets+NumBuckets); + return end(); + } bool insert(const std::pair &KV) { BucketT *TheBucket; @@ -334,7 +340,7 @@ class DenseMapConstIterator : public DenseMapIterator { public: DenseMapConstIterator(const std::pair *Pos, const std::pair *E) - : DenseMapIterator(Pos, E) { + : DenseMapIterator(Pos, E) { } const std::pair &operator*() const { return *this->Ptr;