Index: include/llvm/ADT/SmallPtrSet.h =================================================================== --- include/llvm/ADT/SmallPtrSet.h +++ include/llvm/ADT/SmallPtrSet.h @@ -343,7 +343,9 @@ /// to avoid encoding a particular small size in the interface boundary. template class SmallPtrSetImpl : public SmallPtrSetImplBase { + using ConstPtrType = const typename std::remove_pointer::type *; typedef PointerLikeTypeTraits PtrTraits; + typedef PointerLikeTypeTraits ConstPtrTraits; protected: // Constructors that forward to the base. @@ -375,13 +377,12 @@ bool erase(PtrType Ptr) { return erase_imp(PtrTraits::getAsVoidPointer(Ptr)); } - /// count - Return 1 if the specified pointer is in the set, 0 otherwise. - size_type count(PtrType Ptr) const { + size_type count(ConstPtrType Ptr) const { return find(Ptr) != endPtr() ? 1 : 0; } - iterator find(PtrType Ptr) const { - auto *P = find_imp(PtrTraits::getAsVoidPointer(Ptr)); + iterator find(ConstPtrType Ptr) const { + auto *P = find_imp(ConstPtrTraits::getAsVoidPointer(Ptr)); return iterator(P, EndPointer()); }