<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 4, 2017 at 10:23 PM, Davide Italiano <span dir="ltr"><<a href="mailto:davide@freebsd.org" target="_blank">davide@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Tue, Apr 4, 2017 at 10:06 PM, Rui Ueyama via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: ruiu<br>
> Date: Wed Apr  5 00:06:17 2017<br>
> New Revision: 299511<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=299511&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=299511&view=rev</a><br>
> Log:<br>
> Simplify. NFC.<br>
><br>
> A for-loop is more boring than a find_if, but I think this is easier to read.<br>
><br>
> Modified:<br>
>     lld/trunk/ELF/LinkerScript.cpp<br>
><br>
> Modified: lld/trunk/ELF/LinkerScript.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=299511&r1=299510&r2=299511&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>LinkerScript.cpp?rev=299511&<wbr>r1=299510&r2=299511&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- lld/trunk/ELF/LinkerScript.cpp (original)<br>
> +++ lld/trunk/ELF/LinkerScript.cpp Wed Apr  5 00:06:17 2017<br>
> @@ -923,10 +923,12 @@ std::vector<PhdrEntry> LinkerScript::cre<br>
>  bool LinkerScript::<wbr>ignoreInterpSection() {<br>
>    // Ignore .interp section in case we have PHDRS specification<br>
>    // and PT_INTERP isn't listed.<br>
> -  return !Opt.PhdrsCommands.empty() &&<br>
> -         llvm::find_if(Opt.<wbr>PhdrsCommands, [](const PhdrsCommand &Cmd) {<br>
> -           return Cmd.Type == PT_INTERP;<br>
> -         }) == Opt.PhdrsCommands.end();<br>
> +  if (Opt.PhdrsCommands.empty())<br>
> +    return false;<br>
> +  for (PhdrsCommand &Cmd : Opt.PhdrsCommands)<br>
> +    if (Cmd.Type == PT_INTERP)<br>
> +      return false;<br>
> +  return true;<br>
>  }<br>
><br>
<br>
</div></div>Maybe the `find_if` construct was too obscure, but now that you split<br>
the first `if` out, you may consider replacing the phdrs command loop<br>
with `all_of`, which I think it's an improvement in readability. I<br>
don't feel strong about it tho, up to you.<br></blockquote><div><br></div><div>You still need to use `find_if` instead of `all_of`, no?</div></div></div></div>