Replace std::find_if with plain for loop. NFC.
llvm-svn: 276715
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 1d51a708..5d601dd 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -351,16 +351,14 @@
// were in the script. If a given name did not appear in the script,
// it returns INT_MAX, so that it will be laid out at end of file.
template <class ELFT> int LinkerScript<ELFT>::getSectionIndex(StringRef Name) {
- auto Begin = Opt.Commands.begin();
- auto End = Opt.Commands.end();
- auto I =
- std::find_if(Begin, End, [&](const std::unique_ptr<BaseCommand> &Base) {
- if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base.get()))
- if (Cmd->Name == Name)
- return true;
- return false;
- });
- return I == End ? INT_MAX : (I - Begin);
+ int I = 0;
+ for (std::unique_ptr<BaseCommand> &Base : Opt.Commands) {
+ if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base.get()))
+ if (Cmd->Name == Name)
+ return I;
+ ++I;
+ }
+ return INT_MAX;
}
// A compartor to sort output sections. Returns -1 or 1 if