[PATCH] D40571: Move Memory.{h,cpp} to Common.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 12:32:51 PST 2017


LGTM

Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu created this revision.
> Herald added subscribers: aheejin, sbc100, mgorny, emaste.
>
> Move Memory.{h,cpp} to Common.
>
>
> https://reviews.llvm.org/D40571
>
> Files:
>   lld/COFF/Driver.cpp
>   lld/COFF/DriverUtils.cpp
>   lld/COFF/InputFiles.cpp
>   lld/COFF/Memory.h
>   lld/COFF/SymbolTable.cpp
>   lld/COFF/Symbols.cpp
>   lld/COFF/Symbols.h
>   lld/COFF/Writer.cpp
>   lld/Common/CMakeLists.txt
>   lld/Common/Memory.cpp
>   lld/ELF/Driver.cpp
>   lld/ELF/DriverUtils.cpp
>   lld/ELF/GdbIndex.cpp
>   lld/ELF/InputFiles.cpp
>   lld/ELF/InputSection.cpp
>   lld/ELF/LinkerScript.cpp
>   lld/ELF/MarkLive.cpp
>   lld/ELF/Memory.h
>   lld/ELF/OutputSections.cpp
>   lld/ELF/Relocations.cpp
>   lld/ELF/ScriptParser.cpp
>   lld/ELF/SymbolTable.cpp
>   lld/ELF/SyntheticSections.cpp
>   lld/ELF/Thunks.cpp
>   lld/ELF/Writer.cpp
>   lld/include/lld/Common/Memory.h
>   lld/wasm/Driver.cpp
>   lld/wasm/InputFiles.cpp
>   lld/wasm/Memory.h
>   lld/wasm/OutputSections.cpp
>   lld/wasm/SymbolTable.cpp
>   lld/wasm/Writer.cpp
>
> Index: lld/wasm/Writer.cpp
> ===================================================================
> --- lld/wasm/Writer.cpp
> +++ lld/wasm/Writer.cpp
> @@ -10,12 +10,12 @@
>  #include "Writer.h"
>  
>  #include "Config.h"
> -#include "Memory.h"
>  #include "OutputSections.h"
>  #include "OutputSegment.h"
>  #include "SymbolTable.h"
>  #include "WriterUtils.h"
>  #include "lld/Common/ErrorHandler.h"
> +#include "lld/Common/Memory.h"
>  #include "lld/Common/Threads.h"
>  #include "llvm/Support/FileOutputBuffer.h"
>  #include "llvm/Support/Format.h"
> Index: lld/wasm/SymbolTable.cpp
> ===================================================================
> --- lld/wasm/SymbolTable.cpp
> +++ lld/wasm/SymbolTable.cpp
> @@ -10,9 +10,9 @@
>  #include "SymbolTable.h"
>  
>  #include "Config.h"
> -#include "Memory.h"
>  #include "Strings.h"
>  #include "lld/Common/ErrorHandler.h"
> +#include "lld/Common/Memory.h"
>  
>  #include <unordered_set>
>  
> Index: lld/wasm/OutputSections.cpp
> ===================================================================
> --- lld/wasm/OutputSections.cpp
> +++ lld/wasm/OutputSections.cpp
> @@ -11,10 +11,10 @@
>  
>  #include "Config.h"
>  #include "InputFiles.h"
> -#include "Memory.h"
>  #include "OutputSegment.h"
>  #include "SymbolTable.h"
>  #include "lld/Common/ErrorHandler.h"
> +#include "lld/Common/Memory.h"
>  #include "lld/Common/Threads.h"
>  #include "llvm/ADT/Twine.h"
>  #include "llvm/Support/LEB128.h"
> Index: lld/wasm/Memory.h
> ===================================================================
> --- lld/wasm/Memory.h
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -//===- Memory.h -------------------------------------------------*- C++ -*-===//
> -//
> -//                             The LLVM Linker
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -//
> -// See WASM/Memory.h
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#ifndef LLD_WASM_MEMORY_H
> -#define LLD_WASM_MEMORY_H
> -
> -#include "llvm/Support/Allocator.h"
> -#include "llvm/Support/StringSaver.h"
> -#include <vector>
> -
> -namespace lld {
> -namespace wasm {
> -
> -extern llvm::BumpPtrAllocator BAlloc;
> -extern llvm::StringSaver Saver;
> -
> -struct SpecificAllocBase {
> -  SpecificAllocBase() { Instances.push_back(this); }
> -  virtual ~SpecificAllocBase() = default;
> -  virtual void reset() = 0;
> -  static std::vector<SpecificAllocBase *> Instances;
> -};
> -
> -template <class T> struct SpecificAlloc : public SpecificAllocBase {
> -  void reset() override { Alloc.DestroyAll(); }
> -  llvm::SpecificBumpPtrAllocator<T> Alloc;
> -};
> -
> -template <typename T, typename... U> T *make(U &&... Args) {
> -  static SpecificAlloc<T> Alloc;
> -  return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);
> -}
> -
> -inline void freeArena() {
> -  for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
> -    Alloc->reset();
> -  BAlloc.Reset();
> -}
> -} // namespace wasm
> -} // namespace lld
> -
> -#endif
> Index: lld/wasm/InputFiles.cpp
> ===================================================================
> --- lld/wasm/InputFiles.cpp
> +++ lld/wasm/InputFiles.cpp
> @@ -11,10 +11,10 @@
>  
>  #include "Config.h"
>  #include "InputSegment.h"
> -#include "Memory.h"
>  #include "Strings.h"
>  #include "SymbolTable.h"
>  #include "lld/Common/ErrorHandler.h"
> +#include "lld/Common/Memory.h"
>  #include "llvm/Object/Binary.h"
>  #include "llvm/Object/Wasm.h"
>  #include "llvm/Support/raw_ostream.h"
> Index: lld/wasm/Driver.cpp
> ===================================================================
> --- lld/wasm/Driver.cpp
> +++ lld/wasm/Driver.cpp
> @@ -9,11 +9,11 @@
>  
>  #include "lld/Common/Driver.h"
>  #include "Config.h"
> -#include "Memory.h"
>  #include "SymbolTable.h"
>  #include "Writer.h"
>  #include "lld/Common/Args.h"
>  #include "lld/Common/ErrorHandler.h"
> +#include "lld/Common/Memory.h"
>  #include "lld/Common/Threads.h"
>  #include "lld/Common/Version.h"
>  #include "llvm/ADT/Twine.h"
> @@ -61,9 +61,7 @@
>  
>  } // anonymous namespace
>  
> -std::vector<SpecificAllocBase *> lld::wasm::SpecificAllocBase::Instances;
>  Configuration *lld::wasm::Config;
> -BumpPtrAllocator lld::wasm::BAlloc;
>  
>  bool lld::wasm::link(ArrayRef<const char *> Args, bool CanExitEarly,
>                       raw_ostream &Error) {
> Index: lld/include/lld/Common/Memory.h
> ===================================================================
> --- lld/include/lld/Common/Memory.h
> +++ lld/include/lld/Common/Memory.h
> @@ -21,20 +21,21 @@
>  //
>  //===----------------------------------------------------------------------===//
>  
> -#ifndef LLD_ELF_MEMORY_H
> -#define LLD_ELF_MEMORY_H
> +#ifndef LLD_COMMON_MEMORY_H
> +#define LLD_COMMON_MEMORY_H
>  
>  #include "llvm/Support/Allocator.h"
>  #include "llvm/Support/StringSaver.h"
>  #include <vector>
>  
>  namespace lld {
> -namespace elf {
>  
>  // Use this arena if your object doesn't have a destructor.
>  extern llvm::BumpPtrAllocator BAlloc;
>  extern llvm::StringSaver Saver;
>  
> +void freeArena();
> +
>  // These two classes are hack to keep track of all
>  // SpecificBumpPtrAllocator instances.
>  struct SpecificAllocBase {
> @@ -56,12 +57,6 @@
>    return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);
>  }
>  
> -inline void freeArena() {
> -  for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
> -    Alloc->reset();
> -  BAlloc.Reset();
> -}
> -} // namespace elf
>  } // namespace lld
>  
>  #endif
> Index: lld/ELF/Writer.cpp
> ===================================================================
> --- lld/ELF/Writer.cpp
> +++ lld/ELF/Writer.cpp
> @@ -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"
> Index: lld/ELF/Thunks.cpp
> ===================================================================
> --- lld/ELF/Thunks.cpp
> +++ lld/ELF/Thunks.cpp
> @@ -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"
> Index: lld/ELF/SyntheticSections.cpp
> ===================================================================
> --- lld/ELF/SyntheticSections.cpp
> +++ lld/ELF/SyntheticSections.cpp
> @@ -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"
> Index: lld/ELF/SymbolTable.cpp
> ===================================================================
> --- lld/ELF/SymbolTable.cpp
> +++ lld/ELF/SymbolTable.cpp
> @@ -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"
>  
> Index: lld/ELF/ScriptParser.cpp
> ===================================================================
> --- lld/ELF/ScriptParser.cpp
> +++ lld/ELF/ScriptParser.cpp
> @@ -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"
> Index: lld/ELF/Relocations.cpp
> ===================================================================
> --- lld/ELF/Relocations.cpp
> +++ lld/ELF/Relocations.cpp
> @@ -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"
> Index: lld/ELF/OutputSections.cpp
> ===================================================================
> --- lld/ELF/OutputSections.cpp
> +++ lld/ELF/OutputSections.cpp
> @@ -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"
> Index: lld/ELF/MarkLive.cpp
> ===================================================================
> --- lld/ELF/MarkLive.cpp
> +++ lld/ELF/MarkLive.cpp
> @@ -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>
> Index: lld/ELF/LinkerScript.cpp
> ===================================================================
> --- lld/ELF/LinkerScript.cpp
> +++ lld/ELF/LinkerScript.cpp
> @@ -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"
> Index: lld/ELF/InputSection.cpp
> ===================================================================
> --- lld/ELF/InputSection.cpp
> +++ lld/ELF/InputSection.cpp
> @@ -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"
> Index: lld/ELF/InputFiles.cpp
> ===================================================================
> --- lld/ELF/InputFiles.cpp
> +++ lld/ELF/InputFiles.cpp
> @@ -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"
> Index: lld/ELF/GdbIndex.cpp
> ===================================================================
> --- lld/ELF/GdbIndex.cpp
> +++ lld/ELF/GdbIndex.cpp
> @@ -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"
>  
> Index: lld/ELF/DriverUtils.cpp
> ===================================================================
> --- lld/ELF/DriverUtils.cpp
> +++ lld/ELF/DriverUtils.cpp
> @@ -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"
> Index: lld/ELF/Driver.cpp
> ===================================================================
> --- lld/ELF/Driver.cpp
> +++ lld/ELF/Driver.cpp
> @@ -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"
> @@ -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"
> @@ -65,10 +65,6 @@
>  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,
> Index: lld/Common/Memory.cpp
> ===================================================================
> --- /dev/null
> +++ 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();
> +}
> Index: lld/Common/CMakeLists.txt
> ===================================================================
> --- lld/Common/CMakeLists.txt
> +++ lld/Common/CMakeLists.txt
> @@ -5,6 +5,7 @@
>  add_lld_library(lldCommon
>    Args.cpp
>    ErrorHandler.cpp
> +  Memory.cpp
>    Reproduce.cpp
>    Strings.cpp
>    TargetOptionsCommandFlags.cpp
> Index: lld/COFF/Writer.cpp
> ===================================================================
> --- lld/COFF/Writer.cpp
> +++ lld/COFF/Writer.cpp
> @@ -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"
> Index: lld/COFF/Symbols.h
> ===================================================================
> --- lld/COFF/Symbols.h
> +++ lld/COFF/Symbols.h
> @@ -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"
> Index: lld/COFF/Symbols.cpp
> ===================================================================
> --- lld/COFF/Symbols.cpp
> +++ lld/COFF/Symbols.cpp
> @@ -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"
> Index: lld/COFF/SymbolTable.cpp
> ===================================================================
> --- lld/COFF/SymbolTable.cpp
> +++ lld/COFF/SymbolTable.cpp
> @@ -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"
> Index: lld/COFF/Memory.h
> ===================================================================
> --- lld/COFF/Memory.h
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -//===- Memory.h -------------------------------------------------*- C++ -*-===//
> -//
> -//                             The LLVM Linker
> -//
> -// This file is distributed under the University of Illinois Open Source
> -// License. See LICENSE.TXT for details.
> -//
> -//===----------------------------------------------------------------------===//
> -//
> -// See ELF/Memory.h
> -//
> -//===----------------------------------------------------------------------===//
> -
> -#ifndef LLD_COFF_MEMORY_H
> -#define LLD_COFF_MEMORY_H
> -
> -#include "llvm/Support/Allocator.h"
> -#include "llvm/Support/StringSaver.h"
> -#include <vector>
> -
> -namespace lld {
> -namespace coff {
> -
> -extern llvm::BumpPtrAllocator BAlloc;
> -extern llvm::StringSaver Saver;
> -
> -struct SpecificAllocBase {
> -  SpecificAllocBase() { Instances.push_back(this); }
> -  virtual ~SpecificAllocBase() = default;
> -  virtual void reset() = 0;
> -  static std::vector<SpecificAllocBase *> Instances;
> -};
> -
> -template <class T> struct SpecificAlloc : public SpecificAllocBase {
> -  void reset() override { Alloc.DestroyAll(); }
> -  llvm::SpecificBumpPtrAllocator<T> Alloc;
> -};
> -
> -template <typename T, typename... U> T *make(U &&... Args) {
> -  static SpecificAlloc<T> Alloc;
> -  return new (Alloc.Alloc.Allocate()) T(std::forward<U>(Args)...);
> -}
> -
> -inline void freeArena() {
> -  for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
> -    Alloc->reset();
> -  BAlloc.Reset();
> -}
> -}
> -}
> -
> -#endif
> Index: lld/COFF/InputFiles.cpp
> ===================================================================
> --- lld/COFF/InputFiles.cpp
> +++ lld/COFF/InputFiles.cpp
> @@ -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"
> Index: lld/COFF/DriverUtils.cpp
> ===================================================================
> --- lld/COFF/DriverUtils.cpp
> +++ lld/COFF/DriverUtils.cpp
> @@ -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"
> Index: lld/COFF/Driver.cpp
> ===================================================================
> --- lld/COFF/Driver.cpp
> +++ lld/COFF/Driver.cpp
> @@ -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"
> @@ -50,10 +50,6 @@
>  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;


More information about the llvm-commits mailing list