diff options
author | Rui Ueyama <ruiu@google.com> | 2016-12-08 18:31:13 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2016-12-08 18:31:13 +0000 |
commit | ca7af8d1229fd12b2d3645b5a0c531fd9b2af004 (patch) | |
tree | 1121e3b85e9574d6ae7e06dc60b4cb20668f6175 /lib | |
parent | f2534ab7f2d361853f48637d130fad4e77fedec3 (diff) |
Move Memory.{h,cpp} to lld/Support so that we can use them from COFF.
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@289084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/Support/CMakeLists.txt | 9 | ||||
-rw-r--r-- | lib/Support/Memory.cpp | 27 |
3 files changed, 37 insertions, 0 deletions
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 699f5e93f..acd532230 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -2,3 +2,4 @@ add_subdirectory(Config) add_subdirectory(Core) add_subdirectory(Driver) add_subdirectory(ReaderWriter) +add_subdirectory(Support) diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt new file mode 100644 index 000000000..18dccdbc5 --- /dev/null +++ b/lib/Support/CMakeLists.txt @@ -0,0 +1,9 @@ +add_lld_library(lldSupport + Memory.cpp + + ADDITIONAL_HEADER_DIRS + ${LLD_INCLUDE_DIR}/lld/Support + + LINK_LIBS + LLVMSupport +) diff --git a/lib/Support/Memory.cpp b/lib/Support/Memory.cpp new file mode 100644 index 000000000..9bdcdcc8f --- /dev/null +++ b/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(); +} +} |