Make some minor improvements to APInt:
[oota-llvm.git] / include / llvm / ADT / SmallPtrSet.h
index b9f7b1fc2650aab553002a03ef90d971110c0018..1db2945877a2e6c8b94fd795ae1b4fe793ef00fc 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <cassert>
 #include <cstring>
+#include "llvm/Support/DataTypes.h"
 
 namespace llvm {
 
@@ -50,6 +51,7 @@ protected:
   
   // If small, this is # elts allocated consequtively
   unsigned NumElements;
+  unsigned NumTombstones;
   void *SmallArray[1];  // Must be last ivar.
 public:
   SmallPtrSetImpl(unsigned SmallSize) {
@@ -67,6 +69,9 @@ public:
       delete[] CurArray;
   }
   
+  bool empty() const { return size() == 0; }
+  unsigned size() const { return NumElements; }
+  
   static void *getTombstoneMarker() { return reinterpret_cast<void*>(-2); }
   static void *getEmptyMarker() {
     // Note that -1 is chosen to make clear() efficiently implementable with
@@ -78,6 +83,7 @@ public:
     // Fill the array with empty markers.
     memset(CurArray, -1, CurArraySize*sizeof(void*));
     NumElements = 0;
+    NumTombstones = 0;
   }
   
   /// insert - This returns true if the pointer was new to the set, false if it