Changed the return type of type-specific Allocate() methods to return
authorTed Kremenek <kremenek@apple.com>
Thu, 18 Oct 2007 00:30:14 +0000 (00:30 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 18 Oct 2007 00:30:14 +0000 (00:30 +0000)
void*.  This is hint that we are returning uninitialized memory rather
than a constructed object.

Patched ImutAVLTree to conform to this new interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43106 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/ImmutableSet.h
include/llvm/Support/Allocator.h

index 0210f27b895f4341b00ffcedc602f688c688a1db..c33717a1242a103437d52bdad6d234e57b03652f 100644 (file)
@@ -374,7 +374,7 @@ private:
     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);
 
index 397cf0c7c2e6375daeb8e42abe84aad98895caa6..729cc674a8cd7b995fe1cd347284e71c7ca4d1ca 100644 (file)
@@ -28,7 +28,7 @@ public:
   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 @@ public:
   void *Allocate(unsigned Size, unsigned Alignment);
 
   template <typename T>
-  T* Allocate() { 
+  void *Allocate() { 
     return reinterpret_cast<T*>(Allocate(sizeof(T),AlignOf<T>::Alignment));
   }