ELF: Simplify. NFCI.

We don't need to take a slice of SectionCommands in addOrphanSections()
because it is not modified until the end of the function.

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

llvm-svn: 355954
This commit is contained in:
Peter Collingbourne 2019-03-12 19:19:23 +00:00
parent 18408d5e79
commit 2da7b32684

View File

@ -636,7 +636,6 @@ static OutputSection *addInputSec(StringMap<OutputSection *> &Map,
// Add sections that didn't match any sections command.
void LinkerScript::addOrphanSections() {
unsigned End = SectionCommands.size();
StringMap<OutputSection *> Map;
std::vector<OutputSection *> V;
@ -651,8 +650,7 @@ void LinkerScript::addOrphanSections() {
else if (Config->OrphanHandling == OrphanHandlingPolicy::Warn)
warn(toString(S) + " is being placed in '" + Name + "'");
if (OutputSection *Sec =
findByName(makeArrayRef(SectionCommands).slice(0, End), Name)) {
if (OutputSection *Sec = findByName(SectionCommands, Name)) {
Sec->addSection(cast<InputSection>(S));
return;
}