[lld] r299511 - Simplify. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 4 22:06:18 PDT 2017


Author: ruiu
Date: Wed Apr  5 00:06:17 2017
New Revision: 299511

URL: http://llvm.org/viewvc/llvm-project?rev=299511&view=rev
Log:
Simplify. NFC.

A for-loop is more boring than a find_if, but I think this is easier to read.

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=299511&r1=299510&r2=299511&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Apr  5 00:06:17 2017
@@ -923,10 +923,12 @@ std::vector<PhdrEntry> LinkerScript::cre
 bool LinkerScript::ignoreInterpSection() {
   // Ignore .interp section in case we have PHDRS specification
   // and PT_INTERP isn't listed.
-  return !Opt.PhdrsCommands.empty() &&
-         llvm::find_if(Opt.PhdrsCommands, [](const PhdrsCommand &Cmd) {
-           return Cmd.Type == PT_INTERP;
-         }) == Opt.PhdrsCommands.end();
+  if (Opt.PhdrsCommands.empty())
+    return false;
+  for (PhdrsCommand &Cmd : Opt.PhdrsCommands)
+    if (Cmd.Type == PT_INTERP)
+      return false;
+  return true;
 }
 
 uint32_t LinkerScript::getFiller(StringRef Name) {




More information about the llvm-commits mailing list