[llvm-commits] [llvm] r43106 - in /llvm/trunk/include/llvm: ADT/ImmutableSet.h Support/Allocator.h

Ted Kremenek kremenek at apple.com
Wed Oct 17 17:30:14 PDT 2007


Author: kremenek
Date: Wed Oct 17 19:30:14 2007
New Revision: 43106

URL: http://llvm.org/viewvc/llvm-project?rev=43106&view=rev
Log:
Changed the return type of type-specific Allocate() methods to return
void*.  This is hint that we are returning uninitialized memory rather
than a constructed object.

Patched ImutAVLTree to conform to this new interface.

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

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

==============================================================================
--- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
+++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Wed Oct 17 19:30:14 2007
@@ -374,7 +374,7 @@
     assert (InsertPos != NULL);
     
     // Allocate the new tree node and insert it into the cache.
-    TreeTy* T = Allocator.Allocate<TreeTy>();    
+    TreeTy* T = (TreeTy*) Allocator.Allocate<TreeTy>();    
     new (T) TreeTy(L,R,V,IncrementHeight(L,R));
     Cache.InsertNode(T,InsertPos);
 

Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=43106&r1=43105&r2=43106&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Wed Oct 17 19:30:14 2007
@@ -28,7 +28,7 @@
   void *Allocate(unsigned Size, unsigned Alignment) { return malloc(Size); }
   
   template <typename T>
-  T* Allocate() { return reinterpret_cast<T*>(malloc(sizeof(T))); }
+  void *Allocate() { return reinterpret_cast<T*>(malloc(sizeof(T))); }
   
   void Deallocate(void *Ptr) { free(Ptr); }
   void PrintStats() const {}
@@ -48,7 +48,7 @@
   void *Allocate(unsigned Size, unsigned Alignment);
 
   template <typename T>
-  T* Allocate() { 
+  void *Allocate() { 
     return reinterpret_cast<T*>(Allocate(sizeof(T),AlignOf<T>::Alignment));
   }
 





More information about the llvm-commits mailing list