[ELF] - Simplify. NFC.

llvm-svn: 329785
This commit is contained in:
George Rimar 2018-04-11 09:03:02 +00:00
parent 9f36c7e704
commit 9f0b8e8025
1 changed files with 4 additions and 7 deletions

View File

@ -1234,14 +1234,11 @@ template <class ELFT> void Writer<ELFT>::sortSections() {
if (!Script->HasSectionsCommand) {
// We know that all the OutputSections are contiguous in this case.
auto E = Script->SectionCommands.end();
auto I = Script->SectionCommands.begin();
auto IsSection = [](BaseCommand *Base) { return isa<OutputSection>(Base); };
I = std::find_if(I, E, IsSection);
E = std::find_if(llvm::make_reverse_iterator(E),
llvm::make_reverse_iterator(I), IsSection)
.base();
std::stable_sort(I, E, compareSections);
std::stable_sort(
llvm::find_if(Script->SectionCommands, IsSection),
llvm::find_if(llvm::reverse(Script->SectionCommands), IsSection).base(),
compareSections);
return;
}