diff options
Diffstat (limited to 'lld/lib/Support/Memory.cpp')
-rw-r--r-- | lld/lib/Support/Memory.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lld/lib/Support/Memory.cpp b/lld/lib/Support/Memory.cpp new file mode 100644 index 00000000000..9bdcdcc8fdb --- /dev/null +++ b/lld/lib/Support/Memory.cpp @@ -0,0 +1,27 @@ +//===- Memory.cpp -----------------------------------------------*- C++ -*-===// +// +// The LLVM Linker +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "lld/Support/Memory.h" + +using namespace llvm; + +namespace lld { +BumpPtrAllocator BAlloc; +StringSaver Saver{BAlloc}; + +SpecificAllocBase::SpecificAllocBase() { Instances.push_back(this); } + +std::vector<SpecificAllocBase *> SpecificAllocBase::Instances; + +void freeArena() { + for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances) + Alloc->reset(); + BAlloc.Reset(); +} +} |