From bdd376ccb25f251e115fff24b526b4e65e03a1d3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 31 Mar 2009 20:57:23 +0000 Subject: [PATCH] add some accessors so I can play games with DenseMaps. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68145 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/DenseMap.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index c0f8cee5984..ce0c006cf2b 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -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())) { -- 2.34.1