diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h index 496496b4c151..b0ed33d6ed5a 100644 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -128,11 +128,11 @@ class BumpPtrAllocator { /// one. void DeallocateSlabs(MemSlab *Slab); - static MallocSlabAllocator &GetDefaultSlabAllocator(); + static MallocSlabAllocator DefaultSlabAllocator; public: BumpPtrAllocator(size_t size = 4096, size_t threshold = 4096, - SlabAllocator &allocator = GetDefaultSlabAllocator()); + SlabAllocator &allocator = DefaultSlabAllocator); ~BumpPtrAllocator(); /// Reset - Deallocate all but the current slab and reset the current pointer diff --git a/llvm/lib/Support/Allocator.cpp b/llvm/lib/Support/Allocator.cpp index 19d69f6f944d..31b45c8d4aae 100644 --- a/llvm/lib/Support/Allocator.cpp +++ b/llvm/lib/Support/Allocator.cpp @@ -142,10 +142,8 @@ void BumpPtrAllocator::PrintStats() const { << " (includes alignment, etc)\n"; } -MallocSlabAllocator &BumpPtrAllocator::GetDefaultSlabAllocator() { - static MallocSlabAllocator DefaultSlabAllocator; - return DefaultSlabAllocator; -} +MallocSlabAllocator BumpPtrAllocator::DefaultSlabAllocator = + MallocSlabAllocator(); SlabAllocator::~SlabAllocator() { }