mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-27 02:31:09 +00:00
Make Allocate<T>() return a T* instead of a void*. And use
static_cast instead of reinterpret_cast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52686 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b70e452820
commit
f4dc289cea
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user