Merge addInputSec with OutputSection::addSection.
Previously, when we added an input section to an output section, we
called `OutputSectionFactory::addInputSec`. This isn't a good design
because, a factory class is intended to create a new object and
return it, but in this use case, it will never create a new object.
This patch fixes the design flaw.
llvm-svn: 315138
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 37a5300..577b32f 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -416,7 +416,7 @@
// Add input sections to an output section.
for (InputSectionBase *S : V)
- Factory.addInputSec(S, Sec);
+ Sec->addSection(cast<InputSection>(S));
assert(Sec->SectionIndex == INT_MAX);
Sec->SectionIndex = I;
@@ -466,7 +466,7 @@
if (OutputSection *Sec = findByName(
makeArrayRef(Opt.Commands).slice(0, End), Name)) {
- Factory.addInputSec(S, Sec);
+ Sec->addSection(cast<InputSection>(S));
continue;
}