Simplify InputFile ownership management.
authorRui Ueyama <ruiu@google.com>
Wed, 14 Sep 2016 00:05:51 +0000 (00:05 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 14 Sep 2016 00:05:51 +0000 (00:05 +0000)
commit38dbd3eea9943696166467a407cf45159d8c0f3f
tree666353cf1d5b0e5b3119e9892a2a3e56a09128b0
parentb38d8a3a3baabf759e819fdefd764462691f4048
Simplify InputFile ownership management.

Previously, all input files were owned by the symbol table.
Files were created at various places, such as the Driver, the lazy
symbols, or the bitcode compiler, and the ownership of new files
was transferred to the symbol table using std::unique_ptr.
All input files were then free'd when the symbol table is freed
which is on program exit.

I think we don't have to transfer ownership just to free all
instance at once on exit.

In this patch, all instances are automatically collected to a
vector and freed on exit. In this way, we no longer have to
use std::unique_ptr.

Differential Revision: https://reviews.llvm.org/D24493

llvm-svn: 281425
16 files changed:
lld/ELF/Driver.cpp
lld/ELF/Driver.h
lld/ELF/ICF.cpp
lld/ELF/InputFiles.cpp
lld/ELF/InputFiles.h
lld/ELF/LTO.cpp
lld/ELF/LTO.h
lld/ELF/LinkerScript.cpp
lld/ELF/MarkLive.cpp
lld/ELF/Mips.cpp
lld/ELF/OutputSections.cpp
lld/ELF/SymbolTable.cpp
lld/ELF/SymbolTable.h
lld/ELF/Symbols.cpp
lld/ELF/Symbols.h
lld/ELF/Writer.cpp