Index: lld/trunk/ELF/SyntheticSections.cpp =================================================================== --- lld/trunk/ELF/SyntheticSections.cpp +++ lld/trunk/ELF/SyntheticSections.cpp @@ -2218,15 +2218,14 @@ void elf::decompressAndMergeSections() { // splitIntoPieces needs to be called on each MergeInputSection before calling // finalizeContents(). Do that first. - parallelForEach(InputSections.begin(), InputSections.end(), - [](InputSectionBase *S) { - if (!S->Live) - return; - if (Decompressor::isCompressedELFSection(S->Flags, S->Name)) - S->uncompress(); - if (auto *MS = dyn_cast(S)) - MS->splitIntoPieces(); - }); + parallelForEach(InputSections, [](InputSectionBase *S) { + if (!S->Live) + return; + if (Decompressor::isCompressedELFSection(S->Flags, S->Name)) + S->uncompress(); + if (auto *MS = dyn_cast(S)) + MS->splitIntoPieces(); + }); std::vector MergeSections; for (InputSectionBase *&S : InputSections) { Index: lld/trunk/ELF/Threads.h =================================================================== --- lld/trunk/ELF/Threads.h +++ lld/trunk/ELF/Threads.h @@ -67,12 +67,11 @@ namespace lld { namespace elf { -template -void parallelForEach(IterTy Begin, IterTy End, FuncTy Fn) { +template void parallelForEach(R &&Range, FuncTy Fn) { if (Config->Threads) - for_each(llvm::parallel::par, Begin, End, Fn); + for_each(llvm::parallel::par, std::begin(Range), std::end(Range), Fn); else - for_each(llvm::parallel::seq, Begin, End, Fn); + for_each(llvm::parallel::seq, std::begin(Range), std::end(Range), Fn); } inline void parallelForEachN(size_t Begin, size_t End, Index: lld/trunk/ELF/Writer.cpp =================================================================== --- lld/trunk/ELF/Writer.cpp +++ lld/trunk/ELF/Writer.cpp @@ -199,7 +199,7 @@ // If -compressed-debug-sections is specified, we need to compress // .debug_* sections. Do it right now because it changes the size of // output sections. - parallelForEach(OutputSections.begin(), OutputSections.end(), + parallelForEach(OutputSections, [](OutputSection *Sec) { Sec->maybeCompress(); }); Script->assignAddresses();