From f510fa6b68c9207c8c8797ec976344705b7847b9 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 26 Jul 2016 00:21:15 +0000 Subject: [PATCH] Replace std::find_if with plain for loop. NFC. llvm-svn: 276715 --- lld/ELF/LinkerScript.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index 1d51a70819f9..5d601ddad121 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -351,16 +351,14 @@ ArrayRef LinkerScript::getFiller(StringRef Name) { // 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 int LinkerScript::getSectionIndex(StringRef Name) { - auto Begin = Opt.Commands.begin(); - auto End = Opt.Commands.end(); - auto I = - std::find_if(Begin, End, [&](const std::unique_ptr &Base) { - if (auto *Cmd = dyn_cast(Base.get())) - if (Cmd->Name == Name) - return true; - return false; - }); - return I == End ? INT_MAX : (I - Begin); + int I = 0; + for (std::unique_ptr &Base : Opt.Commands) { + if (auto *Cmd = dyn_cast(Base.get())) + if (Cmd->Name == Name) + return I; + ++I; + } + return INT_MAX; } // A compartor to sort output sections. Returns -1 or 1 if