[llvm-commits] [llvm] r42877 - /llvm/trunk/include/llvm/ADT/ImmutableSet.h

Ted Kremenek kremenek at apple.com
Thu Oct 11 14:51:04 PDT 2007


Author: kremenek
Date: Thu Oct 11 16:51:04 2007
New Revision: 42877

URL: http://llvm.org/viewvc/llvm-project?rev=42877&view=rev
Log:
Provided accessors to internal allocator for ImutAVLTree and ImmutableSet.
Added postfix ++,-- support for ImmutableSet::iterator.

Modified:
    llvm/trunk/include/llvm/ADT/ImmutableSet.h

Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=42877&r1=42876&r2=42877&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Thu Oct 11 16:51:04 2007
@@ -294,6 +294,8 @@
   
   TreeTy* GetEmptyTree() const { return NULL; }
   
+  BumpPtrAllocator& getAllocator() { return Allocator; }
+  
   //===--------------------------------------------------===//    
   // A bunch of quick helper functions used for reasoning
   // about the properties of trees and their children.
@@ -336,6 +338,7 @@
     
     // FIXME: more intelligent calculation of alignment.
     TreeTy* T = (TreeTy*) Allocator.Allocate(sizeof(*T),16);
+    
     new (T) TreeTy(L,R,V,IncrementHeight(L,R));
     
     Cache.InsertNode(T,InsertPos);
@@ -816,6 +819,8 @@
       return ImmutableSet(F.Remove(Old.Root,V));
     }
     
+    BumpPtrAllocator& getAllocator() { return F.getAllocator(); }
+
   private:
     Factory(const Factory& RHS) {};
     void operator=(const Factory& RHS) {};    
@@ -858,7 +863,9 @@
   public:
     inline value_type_ref operator*() const { return itr->getValue(); }
     inline iterator& operator++() { ++itr; return *this; }
+    inline iterator  operator++(int) { iterator tmp(*this); ++itr; return tmp; }
     inline iterator& operator--() { --itr; return *this; }
+    inline iterator  operator--(int) { iterator tmp(*this); --itr; return tmp; }
     inline bool operator==(const iterator& RHS) const { return RHS.itr == itr; }
     inline bool operator!=(const iterator& RHS) const { return RHS.itr != itr; }        
   };





More information about the llvm-commits mailing list