[lld] r299500 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 20:19:06 PDT 2017
Author: ruiu
Date: Tue Apr 4 22:19:06 2017
New Revision: 299500
URL: http://llvm.org/viewvc/llvm-project?rev=299500&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/LinkerScript.cpp
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=299500&r1=299499&r2=299500&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Apr 4 22:19:06 2017
@@ -596,14 +596,10 @@ void LinkerScript::process(BaseCommand &
static OutputSection *
findSection(StringRef Name, const std::vector<OutputSection *> &Sections) {
- auto End = Sections.end();
- auto HasName = [=](OutputSection *Sec) { return Sec->Name == Name; };
- auto I = std::find_if(Sections.begin(), End, HasName);
- std::vector<OutputSection *> Ret;
- if (I == End)
- return nullptr;
- assert(std::find_if(I + 1, End, HasName) == End);
- return *I;
+ for (OutputSection *Sec : Sections)
+ if (Sec->Name == Name)
+ return Sec;
+ return nullptr;
}
// This function searches for a memory region to place the given output
More information about the llvm-commits
mailing list