[lld] r299511 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 22:55:01 PDT 2017
On Tue, Apr 4, 2017 at 10:23 PM, Davide Italiano <davide at freebsd.org> wrote:
> On Tue, Apr 4, 2017 at 10:06 PM, Rui Ueyama via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > 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;
> > }
> >
>
> Maybe the `find_if` construct was too obscure, but now that you split
> the first `if` out, you may consider replacing the phdrs command loop
> with `all_of`, which I think it's an improvement in readability. I
> don't feel strong about it tho, up to you.
>
You still need to use `find_if` instead of `all_of`, no?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170404/3dbe7f8c/attachment-0001.html>
More information about the llvm-commits
mailing list