aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Support/Allocator.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h
index 33cdca13e6..14211488a5 100644
--- a/include/llvm/Support/Allocator.h
+++ b/include/llvm/Support/Allocator.h
@@ -25,12 +25,14 @@ public:
~MallocAllocator() {}
void Reset() {}
+
void *Allocate(size_t Size, size_t Alignment) { return malloc(Size); }
template <typename T>
- void *Allocate() { return reinterpret_cast<T*>(malloc(sizeof(T))); }
+ T *Allocate() { return static_cast<T*>(malloc(sizeof(T))); }
void Deallocate(void *Ptr) { free(Ptr); }
+
void PrintStats() const {}
};
@@ -45,15 +47,16 @@ public:
~BumpPtrAllocator();
void Reset();
+
void *Allocate(size_t Size, size_t Alignment);
template <typename T>
- void *Allocate() {
- return reinterpret_cast<T*>(Allocate(sizeof(T),AlignOf<T>::Alignment));
+ T *Allocate() {
+ return static_cast<T*>(Allocate(sizeof(T),AlignOf<T>::Alignment));
}
-
void Deallocate(void *Ptr) {}
+
void PrintStats() const;
};