[lld] r285763 - Remove Out::Pool and use make() instead.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 1 16:09:08 PDT 2016
Author: ruiu
Date: Tue Nov 1 18:09:07 2016
New Revision: 285763
URL: http://llvm.org/viewvc/llvm-project?rev=285763&view=rev
Log:
Remove Out::Pool and use make() instead.
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/OutputSections.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=285763&r1=285762&r2=285763&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Nov 1 18:09:07 2016
@@ -543,8 +543,7 @@ template <class ELFT> void LinkerScript<
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);
}
}
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=285763&r1=285762&r2=285763&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Tue Nov 1 18:09:07 2016
@@ -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
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};
}
Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=285763&r1=285762&r2=285763&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Tue Nov 1 18:09:07 2016
@@ -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<
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
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=285763&r1=285762&r2=285763&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Nov 1 18:09:07 2016
@@ -247,7 +247,6 @@ template <class ELFT> void elf::writeRes
In<ELFT>::Sections = {BuildId.get()};
Writer<ELFT>().run();
- Out<ELFT>::Pool.clear();
}
template <class ELFT> static std::vector<DefinedCommon *> getCommonSymbols() {
More information about the llvm-commits
mailing list