diff options
Diffstat (limited to 'include/llvm/Support/Allocator.h')
-rw-r--r-- | include/llvm/Support/Allocator.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/Support/Allocator.h b/include/llvm/Support/Allocator.h index b1f59dc05e..a58b9db27f 100644 --- a/include/llvm/Support/Allocator.h +++ b/include/llvm/Support/Allocator.h @@ -134,6 +134,7 @@ class BumpPtrAllocator { static MallocSlabAllocator DefaultSlabAllocator; public: + typedef void (*DTorFunction)(void*); BumpPtrAllocator(size_t size = 4096, size_t threshold = 4096, SlabAllocator &allocator = DefaultSlabAllocator); ~BumpPtrAllocator(); @@ -142,6 +143,11 @@ public: /// to the beginning of it, freeing all memory allocated so far. void Reset(); + /// Reset - like Reset(), but call DTorFunction for each allocated + /// object. This assumes that all objects allocated with this allocator + /// had the same size and alignment specified here. + void Reset(size_t Size, size_t Alignment, DTorFunction DTor); + /// Allocate - Allocate space at the specified alignment. /// void *Allocate(size_t Size, size_t Alignment); |