aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h')
-rw-r--r--contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h b/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h
index 840f328db796..a82afc9a817c 100644
--- a/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h
+++ b/contrib/llvm-project/llvm/include/llvm/ADT/StringMap.h
@@ -78,10 +78,12 @@ protected:
void init(unsigned Size);
public:
+ static constexpr uintptr_t TombstoneIntVal =
+ static_cast<uintptr_t>(-1)
+ << PointerLikeTypeTraits<StringMapEntryBase *>::NumLowBitsAvailable;
+
static StringMapEntryBase *getTombstoneVal() {
- uintptr_t Val = static_cast<uintptr_t>(-1);
- Val <<= PointerLikeTypeTraits<StringMapEntryBase *>::NumLowBitsAvailable;
- return reinterpret_cast<StringMapEntryBase *>(Val);
+ return reinterpret_cast<StringMapEntryBase *>(TombstoneIntVal);
}
unsigned getNumBuckets() const { return NumBuckets; }
@@ -387,7 +389,9 @@ public:
return static_cast<DerivedTy &>(*this);
}
- bool operator==(const DerivedTy &RHS) const { return Ptr == RHS.Ptr; }
+ friend bool operator==(const DerivedTy &LHS, const DerivedTy &RHS) {
+ return LHS.Ptr == RHS.Ptr;
+ }
DerivedTy &operator++() { // Preincrement
++Ptr;