add some accessors so I can play games with DenseMaps.

llvm-svn: 68145
This commit is contained in:
Chris Lattner 2009-03-31 20:57:23 +00:00
parent e521a8994c
commit e0d25e42e9
1 changed files with 12 additions and 0 deletions

View File

@ -279,6 +279,18 @@ public:
return *this;
}
/// isPointerIntoBucketsArray - Return true if the specified pointer points
/// somewhere into the DenseMap's array of buckets (i.e. either to a key or
/// value in the DenseMap).
bool isPointerIntoBucketsArray(const void *Ptr) const {
return Ptr >= Buckets && Ptr < Buckets+NumBuckets;
}
/// getPointerIntoBucketsArray() - Return an opaque pointer into the buckets
/// array. In conjunction with the previous method, this can be used to
/// determine whether an insertion caused the DenseMap to reallocate.
const void *getPointerIntoBucketsArray() const { return Buckets; }
private:
void CopyFrom(const DenseMap& other) {
if (NumBuckets != 0 && (!KeyInfoT::isPod() || !ValueInfoT::isPod())) {