X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FSupport%2FRecyclingAllocator.h;h=34ab874778c912bc7fba98459c5fd0f189138509;hb=5df15c692b944b6c46ec6d532fc286b7e0000d5d;hp=a338c0eb6397c272e9fa723dc70318eef5e2b977;hpb=e14d81deeb6bb3404ffee5e59ecb88304f112f4a;p=oota-llvm.git diff --git a/include/llvm/Support/RecyclingAllocator.h b/include/llvm/Support/RecyclingAllocator.h index a338c0eb639..34ab874778c 100644 --- a/include/llvm/Support/RecyclingAllocator.h +++ b/include/llvm/Support/RecyclingAllocator.h @@ -15,21 +15,20 @@ #ifndef LLVM_SUPPORT_RECYCLINGALLOCATOR_H #define LLVM_SUPPORT_RECYCLINGALLOCATOR_H -#include #include "llvm/Support/Recycler.h" -#include "llvm/ADT/STLExtras.h" namespace llvm { /// RecyclingAllocator - This class wraps an Allocator, adding the /// functionality of recycling deleted objects. /// -template +template::Alignment> class RecyclingAllocator { private: /// Base - Implementation details. /// - Recycler Base; + Recycler Base; /// Allocator - The wrapped allocator. /// @@ -42,7 +41,7 @@ public: /// SubClass. The storage may be either newly allocated or recycled. /// template - SubClass *Allocate() { return Base.Allocate(Allocator); } + SubClass *Allocate() { return Base.template Allocate(Allocator); } T *Allocate() { return Base.Allocate(Allocator); } @@ -57,4 +56,18 @@ public: } +template +inline void *operator new(size_t, + llvm::RecyclingAllocator &Allocator) { + return Allocator.Allocate(); +} + +template +inline void operator delete(void *E, + llvm::RecyclingAllocator &A) { + A.Deallocate(E); +} + #endif