Skip to content

Commit

Permalink
Move Memory.{h,cpp} to Common.
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D40571

llvm-svn: 319221
  • Loading branch information
rui314 committed Nov 28, 2017
1 parent 7b361b5 commit 2017d52
Show file tree
Hide file tree
Showing 31 changed files with 54 additions and 151 deletions.
6 changes: 1 addition & 5 deletions lld/COFF/Driver.cpp
Expand Up @@ -10,13 +10,13 @@
#include "Driver.h"
#include "Config.h"
#include "InputFiles.h"
#include "Memory.h"
#include "MinGW.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "Writer.h"
#include "lld/Common/Driver.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSwitch.h"
Expand Down Expand Up @@ -50,10 +50,6 @@ namespace coff {
Configuration *Config;
LinkerDriver *Driver;

BumpPtrAllocator BAlloc;
StringSaver Saver{BAlloc};
std::vector<SpecificAllocBase *> SpecificAllocBase::Instances;

bool link(ArrayRef<const char *> Args, bool CanExitEarly, raw_ostream &Diag) {
errorHandler().LogName = Args[0];
errorHandler().ErrorOS = &Diag;
Expand Down
2 changes: 1 addition & 1 deletion lld/COFF/DriverUtils.cpp
Expand Up @@ -15,9 +15,9 @@

#include "Config.h"
#include "Driver.h"
#include "Memory.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/BinaryFormat/COFF.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/COFF/InputFiles.cpp
Expand Up @@ -11,10 +11,10 @@
#include "Chunks.h"
#include "Config.h"
#include "Driver.h"
#include "Memory.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm-c/lto.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Triple.h"
Expand Down
52 changes: 0 additions & 52 deletions lld/COFF/Memory.h

This file was deleted.

2 changes: 1 addition & 1 deletion lld/COFF/SymbolTable.cpp
Expand Up @@ -11,9 +11,9 @@
#include "Config.h"
#include "Driver.h"
#include "LTO.h"
#include "Memory.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/COFF/Symbols.cpp
Expand Up @@ -9,9 +9,9 @@

#include "Symbols.h"
#include "InputFiles.h"
#include "Memory.h"
#include "Strings.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/COFF/Symbols.h
Expand Up @@ -12,8 +12,8 @@

#include "Chunks.h"
#include "Config.h"
#include "Memory.h"
#include "lld/Common/LLVM.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/COFF.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/COFF/Writer.cpp
Expand Up @@ -12,11 +12,11 @@
#include "DLL.h"
#include "InputFiles.h"
#include "MapFile.h"
#include "Memory.h"
#include "PDB.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
Expand Down
1 change: 1 addition & 0 deletions lld/Common/CMakeLists.txt
Expand Up @@ -5,6 +5,7 @@ endif()
add_lld_library(lldCommon
Args.cpp
ErrorHandler.cpp
Memory.cpp
Reproduce.cpp
Strings.cpp
TargetOptionsCommandFlags.cpp
Expand Down
23 changes: 23 additions & 0 deletions lld/Common/Memory.cpp
@@ -0,0 +1,23 @@
//===- Memory.cpp ---------------------------------------------------------===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "lld/Common/Memory.h"

using namespace llvm;
using namespace lld;

BumpPtrAllocator lld::BAlloc;
StringSaver lld::Saver{BAlloc};
std::vector<SpecificAllocBase *> lld::SpecificAllocBase::Instances;

void lld::freeArena() {
for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
Alloc->reset();
BAlloc.Reset();
}
6 changes: 1 addition & 5 deletions lld/ELF/Driver.cpp
Expand Up @@ -30,7 +30,6 @@
#include "InputFiles.h"
#include "InputSection.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "ScriptParser.h"
#include "Strings.h"
Expand All @@ -41,6 +40,7 @@
#include "lld/Common/Args.h"
#include "lld/Common/Driver.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/StringExtras.h"
Expand All @@ -65,10 +65,6 @@ using namespace lld::elf;
Configuration *elf::Config;
LinkerDriver *elf::Driver;

BumpPtrAllocator elf::BAlloc;
StringSaver elf::Saver{BAlloc};
std::vector<SpecificAllocBase *> elf::SpecificAllocBase::Instances;

static void setConfigs();

bool elf::link(ArrayRef<const char *> Args, bool CanExitEarly,
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/DriverUtils.cpp
Expand Up @@ -14,8 +14,8 @@
//===----------------------------------------------------------------------===//

#include "Driver.h"
#include "Memory.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Reproduce.h"
#include "lld/Common/Version.h"
#include "llvm/ADT/Optional.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/GdbIndex.cpp
Expand Up @@ -15,7 +15,7 @@
//===----------------------------------------------------------------------===//

#include "GdbIndex.h"
#include "Memory.h"
#include "lld/Common/Memory.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
#include "llvm/Object/ELFObjectFile.h"

Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/InputFiles.cpp
Expand Up @@ -10,11 +10,11 @@
#include "InputFiles.h"
#include "InputSection.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/InputSection.cpp
Expand Up @@ -12,13 +12,13 @@
#include "EhFrame.h"
#include "InputFiles.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Relocations.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "Thunks.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm/Object/Decompressor.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Compression.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/LinkerScript.cpp
Expand Up @@ -14,14 +14,14 @@
#include "LinkerScript.h"
#include "Config.h"
#include "InputSection.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "Writer.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/MarkLive.cpp
Expand Up @@ -22,13 +22,13 @@

#include "InputSection.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Symbols.h"
#include "Target.h"
#include "Writer.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Object/ELF.h"
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/OutputSections.cpp
Expand Up @@ -10,11 +10,11 @@
#include "OutputSections.h"
#include "Config.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/Compression.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/Relocations.cpp
Expand Up @@ -44,13 +44,13 @@
#include "Relocations.h"
#include "Config.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "Thunks.h"
#include "lld/Common/Memory.h"

#include "llvm/Support/Endian.h"
#include "llvm/Support/raw_ostream.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/ScriptParser.cpp
Expand Up @@ -17,11 +17,11 @@
#include "Driver.h"
#include "InputSection.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "ScriptLexer.h"
#include "Symbols.h"
#include "Target.h"
#include "lld/Common/Memory.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/SymbolTable.cpp
Expand Up @@ -17,10 +17,10 @@
#include "SymbolTable.h"
#include "Config.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Strings.h"
#include "llvm/ADT/STLExtras.h"

Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/SyntheticSections.cpp
Expand Up @@ -19,13 +19,13 @@
#include "Config.h"
#include "InputFiles.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Target.h"
#include "Writer.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "lld/Common/Version.h"
#include "llvm/BinaryFormat/Dwarf.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/Thunks.cpp
Expand Up @@ -24,12 +24,12 @@
#include "Thunks.h"
#include "Config.h"
#include "InputSection.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Symbols.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "lld/Common/ErrorHandler.h"
#include "lld/Common/Memory.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Endian.h"
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/Writer.cpp
Expand Up @@ -12,13 +12,13 @@
#include "Filesystem.h"
#include "LinkerScript.h"
#include "MapFile.h"
#include "Memory.h"
#include "OutputSections.h"
#include "Relocations.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "SyntheticSections.h"
#include "Target.h"
#include "lld/Common/Memory.h"
#include "lld/Common/Threads.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSwitch.h"
Expand Down

0 comments on commit 2017d52

Please sign in to comment.