Simplify. NFC.

llvm-svn: 299500
This commit is contained in:
Rui Ueyama
2017-04-05 03:19:06 +00:00
parent 2e081a4ff0
commit 0b2381e71f

View File

@@ -596,14 +596,10 @@ void LinkerScript::process(BaseCommand &Base) {
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