summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2014-02-03 11:24:18 +0000
committerChandler Carruth <chandlerc@gmail.com>2014-02-03 11:24:18 +0000
commite3f87943291d589059a9f2838e5dbb05bc91d7dd (patch)
tree1392596d378a61d2c6eabec05ebd3790ce80c045 /include
parenta3db8124abd18cd9e6cd6783cda8a549a61f1308 (diff)
downloadllvm-e3f87943291d589059a9f2838e5dbb05bc91d7dd.tar.gz
llvm-e3f87943291d589059a9f2838e5dbb05bc91d7dd.tar.bz2
llvm-e3f87943291d589059a9f2838e5dbb05bc91d7dd.tar.xz
Rename the non-templated base class of SmallPtrSet to
'SmallPtrSetImplBase'. This more closely matches the organization of SmallVector and should allow introducing a SmallPtrSetImpl which serves the same purpose as SmallVectorImpl: isolating the element type from the particular small size chosen. This in turn allows a lot of simplification of APIs by not coding them against a specific small size which is rarely needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200687 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/SmallPtrSet.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/include/llvm/ADT/SmallPtrSet.h b/include/llvm/ADT/SmallPtrSet.h
index e433c57de7..b073005321 100644
--- a/include/llvm/ADT/SmallPtrSet.h
+++ b/include/llvm/ADT/SmallPtrSet.h
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
//
// This file defines the SmallPtrSet class. See the doxygen comment for
-// SmallPtrSetImpl for more details on the algorithm used.
+// SmallPtrSetImplBase for more details on the algorithm used.
//
//===----------------------------------------------------------------------===//
@@ -27,7 +27,7 @@ namespace llvm {
class SmallPtrSetIteratorImpl;
-/// SmallPtrSetImpl - This is the common code shared among all the
+/// SmallPtrSetImplBase - This is the common code shared among all the
/// SmallPtrSet<>'s, which is almost everything. SmallPtrSet has two modes, one
/// for small and one for large sets.
///
@@ -45,7 +45,7 @@ class SmallPtrSetIteratorImpl;
/// (-2), to allow deletion. The hash table is resized when the table is 3/4 or
/// more. When this happens, the table is doubled in size.
///
-class SmallPtrSetImpl {
+class SmallPtrSetImplBase {
friend class SmallPtrSetIteratorImpl;
protected:
/// SmallArray - Points to a fixed size set of buckets, used in 'small mode'.
@@ -61,18 +61,18 @@ protected:
unsigned NumTombstones;
// Helpers to copy and move construct a SmallPtrSet.
- SmallPtrSetImpl(const void **SmallStorage, const SmallPtrSetImpl &that);
+ SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that);
#if LLVM_HAS_RVALUE_REFERENCES
- SmallPtrSetImpl(const void **SmallStorage, unsigned SmallSize,
- SmallPtrSetImpl &&that);
+ SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize,
+ SmallPtrSetImplBase &&that);
#endif
- explicit SmallPtrSetImpl(const void **SmallStorage, unsigned SmallSize) :
+ explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize) :
SmallArray(SmallStorage), CurArray(SmallStorage), CurArraySize(SmallSize) {
assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 &&
"Initial size must be a power of two!");
clear();
}
- ~SmallPtrSetImpl();
+ ~SmallPtrSetImplBase();
public:
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return size() == 0; }
@@ -132,15 +132,15 @@ private:
/// Grow - Allocate a larger backing store for the buckets and move it over.
void Grow(unsigned NewSize);
- void operator=(const SmallPtrSetImpl &RHS) LLVM_DELETED_FUNCTION;
+ void operator=(const SmallPtrSetImplBase &RHS) LLVM_DELETED_FUNCTION;
protected:
/// swap - Swaps the elements of two sets.
/// Note: This method assumes that both sets have the same small size.
- void swap(SmallPtrSetImpl &RHS);
+ void swap(SmallPtrSetImplBase &RHS);
- void CopyFrom(const SmallPtrSetImpl &RHS);
+ void CopyFrom(const SmallPtrSetImplBase &RHS);
#if LLVM_HAS_RVALUE_REFERENCES
- void MoveFrom(unsigned SmallSize, SmallPtrSetImpl &&RHS);
+ void MoveFrom(unsigned SmallSize, SmallPtrSetImplBase &&RHS);
#endif
};
@@ -170,8 +170,8 @@ protected:
void AdvanceIfNotValid() {
assert(Bucket <= End);
while (Bucket != End &&
- (*Bucket == SmallPtrSetImpl::getEmptyMarker() ||
- *Bucket == SmallPtrSetImpl::getTombstoneMarker()))
+ (*Bucket == SmallPtrSetImplBase::getEmptyMarker() ||
+ *Bucket == SmallPtrSetImplBase::getTombstoneMarker()))
++Bucket;
}
};
@@ -238,24 +238,24 @@ struct RoundUpToPowerOfTwo {
/// SmallPtrSet - This class implements a set which is optimized 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.
+/// SmallPtrSetImplBase for details of the algorithm.
template<class PtrType, unsigned SmallSize>
-class SmallPtrSet : public SmallPtrSetImpl {
+class SmallPtrSet : public SmallPtrSetImplBase {
// Make sure that SmallSize is a power of two, round up if not.
enum { SmallSizePowTwo = RoundUpToPowerOfTwo<SmallSize>::Val };
/// SmallStorage - Fixed size storage used in 'small mode'.
const void *SmallStorage[SmallSizePowTwo];
typedef PointerLikeTypeTraits<PtrType> PtrTraits;
public:
- SmallPtrSet() : SmallPtrSetImpl(SmallStorage, SmallSizePowTwo) {}
- SmallPtrSet(const SmallPtrSet &that) : SmallPtrSetImpl(SmallStorage, that) {}
+ SmallPtrSet() : SmallPtrSetImplBase(SmallStorage, SmallSizePowTwo) {}
+ SmallPtrSet(const SmallPtrSet &that) : SmallPtrSetImplBase(SmallStorage, that) {}
#if LLVM_HAS_RVALUE_REFERENCES
SmallPtrSet(SmallPtrSet &&that)
- : SmallPtrSetImpl(SmallStorage, SmallSizePowTwo, std::move(that)) {}
+ : SmallPtrSetImplBase(SmallStorage, SmallSizePowTwo, std::move(that)) {}
#endif
template<typename It>
- SmallPtrSet(It I, It E) : SmallPtrSetImpl(SmallStorage, SmallSizePowTwo) {
+ SmallPtrSet(It I, It E) : SmallPtrSetImplBase(SmallStorage, SmallSizePowTwo) {
insert(I, E);
}
@@ -309,7 +309,7 @@ public:
/// swap - Swaps the elements of two sets.
void swap(SmallPtrSet<PtrType, SmallSize> &RHS) {
- SmallPtrSetImpl::swap(RHS);
+ SmallPtrSetImplBase::swap(RHS);
}
};