Changes in directory llvm/include/llvm/ADT:
SmallPtrSet.h updated: 1.3 -> 1.4 --- Log message: implement SmallPtrSet::erase --- Diffs of the changes: (+10 -3) SmallPtrSet.h | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) Index: llvm/include/llvm/ADT/SmallPtrSet.h diff -u llvm/include/llvm/ADT/SmallPtrSet.h:1.3 llvm/include/llvm/ADT/SmallPtrSet.h:1.4 --- llvm/include/llvm/ADT/SmallPtrSet.h:1.3 Sat Jan 27 01:52:27 2007 +++ llvm/include/llvm/ADT/SmallPtrSet.h Sat Jan 27 01:59:10 2007 @@ -67,8 +67,6 @@ delete[] CurArray; } - bool isSmall() const { return CurArray == &SmallArray[0]; } - static void *getTombstoneMarker() { return reinterpret_cast<void*>(-2); } static void *getEmptyMarker() { // Note that -1 is chosen to make clear() efficiently implementable with @@ -86,6 +84,10 @@ /// was already in the set. bool insert(void *Ptr); + /// erase - If the set contains the specified pointer, remove it and return + /// true, otherwise return false. + bool erase(void *Ptr); + bool count(void *Ptr) const { if (isSmall()) { // Linear search for the item. @@ -101,6 +103,8 @@ } private: + bool isSmall() const { return CurArray == &SmallArray[0]; } + unsigned Hash(void *Ptr) const { return ((uintptr_t)Ptr >> 4) & (CurArraySize-1); } @@ -188,7 +192,10 @@ }; -/// SmallPtrSet - This class implements +/// SmallPtrSet - This class implements a set which is optimizer for holding +/// SmallSize or less elements. This internally rounds up SmallSize to the next +/// power of two if it is not already a power of two. See the comments above +/// SmallPtrSetImpl for details of the algorithm. template<class PtrType, unsigned SmallSize> class SmallPtrSet : public SmallPtrSetImpl { // Make sure that SmallSize is a power of two, round up if not. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits