Remove Out::Pool and use make() instead.

llvm-svn: 285763
This commit is contained in:
Rui Ueyama 2016-11-01 23:09:07 +00:00
parent 3d463193a9
commit 95642b95bd
4 changed files with 8 additions and 17 deletions

View File

@ -543,8 +543,7 @@ template <class ELFT> void LinkerScript<ELFT>::adjustSectionsBeforeSorting() {
continue;
}
auto *OutSec = new OutputSection<ELFT>(Cmd->Name, Type, Flags);
Out<ELFT>::Pool.emplace_back(OutSec);
auto *OutSec = make<OutputSection<ELFT>>(Cmd->Name, Type, Flags);
OutputSections->push_back(OutSec);
}
}

View File

@ -10,8 +10,9 @@
#include "OutputSections.h"
#include "Config.h"
#include "EhFrame.h"
#include "LinkerScript.h"
#include "GdbIndex.h"
#include "LinkerScript.h"
#include "Memory.h"
#include "Strings.h"
#include "SymbolTable.h"
#include "Target.h"
@ -1881,24 +1882,23 @@ OutputSectionFactory<ELFT>::create(const SectionKey<ELFT::Is64Bits> &Key,
uint32_t Type = C->Type;
switch (C->kind()) {
case InputSectionBase<ELFT>::Regular:
Sec = new OutputSection<ELFT>(Key.Name, Type, Flags);
Sec = make<OutputSection<ELFT>>(Key.Name, Type, Flags);
break;
case InputSectionBase<ELFT>::EHFrame:
return {Out<ELFT>::EhFrame, false};
case InputSectionBase<ELFT>::Merge:
Sec = new MergeOutputSection<ELFT>(Key.Name, Type, Flags, Key.Alignment);
Sec = make<MergeOutputSection<ELFT>>(Key.Name, Type, Flags, Key.Alignment);
break;
case InputSectionBase<ELFT>::MipsReginfo:
Sec = new MipsReginfoOutputSection<ELFT>();
Sec = make<MipsReginfoOutputSection<ELFT>>();
break;
case InputSectionBase<ELFT>::MipsOptions:
Sec = new MipsOptionsOutputSection<ELFT>();
Sec = make<MipsOptionsOutputSection<ELFT>>();
break;
case InputSectionBase<ELFT>::MipsAbiFlags:
Sec = new MipsAbiFlagsOutputSection<ELFT>();
Sec = make<MipsAbiFlagsOutputSection<ELFT>>();
break;
}
Out<ELFT>::Pool.emplace_back(Sec);
return {Sec, true};
}

View File

@ -773,9 +773,6 @@ template <class ELFT> struct Out {
static OutputSectionBase<ELFT> *PreinitArray;
static OutputSectionBase<ELFT> *InitArray;
static OutputSectionBase<ELFT> *FiniArray;
// This pool owns dynamically-allocated output sections.
static std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Pool;
};
template <bool Is64Bits> struct SectionKey {
@ -842,10 +839,6 @@ template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::ProgramHeaders;
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::PreinitArray;
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::InitArray;
template <class ELFT> OutputSectionBase<ELFT> *Out<ELFT>::FiniArray;
template <class ELFT>
std::vector<std::unique_ptr<OutputSectionBase<ELFT>>> Out<ELFT>::Pool;
} // namespace elf
} // namespace lld

View File

@ -247,7 +247,6 @@ template <class ELFT> void elf::writeResult() {
In<ELFT>::Sections = {BuildId.get()};
Writer<ELFT>().run();
Out<ELFT>::Pool.clear();
}
template <class ELFT> static std::vector<DefinedCommon *> getCommonSymbols() {