[lld] r329785 - [ELF] - Simplify. NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 11 02:03:02 PDT 2018
Author: grimar
Date: Wed Apr 11 02:03:02 2018
New Revision: 329785
URL: http://llvm.org/viewvc/llvm-project?rev=329785&view=rev
Log:
[ELF] - Simplify. NFC.
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=329785&r1=329784&r2=329785&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Apr 11 02:03:02 2018
@@ -1234,14 +1234,11 @@ template <class ELFT> void Writer<ELFT>:
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;
}
More information about the llvm-commits
mailing list