<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>