2016-10-28 20:57:25 +00:00
|
|
|
//===- Memory.cpp -----------------------------------------------*- C++ -*-===//
|
|
|
|
|
//
|
|
|
|
|
// The LLVM Linker
|
|
|
|
|
//
|
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2016-12-08 18:31:13 +00:00
|
|
|
#include "lld/Support/Memory.h"
|
2016-10-28 20:57:25 +00:00
|
|
|
|
2016-10-29 01:28:06 +00:00
|
|
|
using namespace llvm;
|
2016-10-28 20:57:25 +00:00
|
|
|
|
2016-10-29 01:28:06 +00:00
|
|
|
namespace lld {
|
2016-12-08 18:31:13 +00:00
|
|
|
BumpPtrAllocator BAlloc;
|
|
|
|
|
StringSaver Saver{BAlloc};
|
2016-10-29 01:28:06 +00:00
|
|
|
|
2016-11-01 21:06:40 +00:00
|
|
|
SpecificAllocBase::SpecificAllocBase() { Instances.push_back(this); }
|
|
|
|
|
|
|
|
|
|
std::vector<SpecificAllocBase *> SpecificAllocBase::Instances;
|
|
|
|
|
|
2016-12-08 18:31:13 +00:00
|
|
|
void freeArena() {
|
2016-11-01 21:06:40 +00:00
|
|
|
for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
|
|
|
|
|
Alloc->reset();
|
|
|
|
|
BAlloc.Reset();
|
|
|
|
|
}
|
2016-10-29 01:28:06 +00:00
|
|
|
}
|