diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index 745288ff047f4..00290c9dd0a58 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -678,10 +678,9 @@ class DenseMapBase : public DebugEpochBase { /// FoundBucket. If the bucket contains the key and a value, this returns /// true, otherwise it returns a bucket with an empty marker or tombstone and /// returns false. - template - bool LookupBucketFor(const LookupKeyT &Val, - const BucketT *&FoundBucket) const { - const BucketT *BucketsPtr = getBuckets(); + template + bool LookupBucketFor(const LookupKeyT &Val, BucketT *&FoundBucket) { + BucketT *BucketsPtr = getBuckets(); const unsigned NumBuckets = getNumBuckets(); if (NumBuckets == 0) { @@ -690,7 +689,7 @@ class DenseMapBase : public DebugEpochBase { } // FoundTombstone - Keep track of whether we find a tombstone while probing. - const BucketT *FoundTombstone = nullptr; + BucketT *FoundTombstone = nullptr; const KeyT EmptyKey = getEmptyKey(); const KeyT TombstoneKey = getTombstoneKey(); assert(!KeyInfoT::isEqual(Val, EmptyKey) && @@ -700,7 +699,7 @@ class DenseMapBase : public DebugEpochBase { unsigned BucketNo = getHashValue(Val) & (NumBuckets-1); unsigned ProbeAmt = 1; while (true) { - const BucketT *ThisBucket = BucketsPtr + BucketNo; + BucketT *ThisBucket = BucketsPtr + BucketNo; // Found Val's bucket? If so, return it. if (LLVM_LIKELY(KeyInfoT::isEqual(Val, ThisBucket->getFirst()))) { FoundBucket = ThisBucket; @@ -729,15 +728,6 @@ class DenseMapBase : public DebugEpochBase { } } - template - bool LookupBucketFor(const LookupKeyT &Val, BucketT *&FoundBucket) { - const BucketT *ConstFoundBucket; - bool Result = const_cast(this) - ->LookupBucketFor(Val, ConstFoundBucket); - FoundBucket = const_cast(ConstFoundBucket); - return Result; - } - public: /// Return the approximate size (in bytes) of the actual map. /// This is just the raw memory used by DenseMap.