Remove Out::Pool and use make() instead.
llvm-svn: 285763
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 6e7b775..b51cf80 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -543,8 +543,7 @@
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);
}
}
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp
index 9be3b3b..131aff5 100644
--- a/lld/ELF/OutputSections.cpp
+++ b/lld/ELF/OutputSections.cpp
@@ -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 @@
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};
}
diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h
index 2e039d0..36cbf4e 100644
--- a/lld/ELF/OutputSections.h
+++ b/lld/ELF/OutputSections.h
@@ -773,9 +773,6 @@
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>::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
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 2c0057a..2f9dc41 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -247,7 +247,6 @@
In<ELFT>::Sections = {BuildId.get()};
Writer<ELFT>().run();
- Out<ELFT>::Pool.clear();
}
template <class ELFT> static std::vector<DefinedCommon *> getCommonSymbols() {