[lld] r256379 - Remove `continue` to make the code a bit shorter. NFC.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 21:35:18 PST 2016


On Thu, Dec 24, 2015 at 2:14 AM, Rui Ueyama via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: ruiu
> Date: Thu Dec 24 04:14:05 2015
> New Revision: 256379
>
> URL: http://llvm.org/viewvc/llvm-project?rev=256379&view=rev
> Log:
> Remove `continue` to make the code a bit shorter. NFC.
>
> Modified:
>     lld/trunk/ELF/MarkLive.cpp
>
> Modified: lld/trunk/ELF/MarkLive.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=256379&r1=256378&r2=256379&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/MarkLive.cpp (original)
> +++ lld/trunk/ELF/MarkLive.cpp Thu Dec 24 04:14:05 2015
> @@ -114,14 +114,11 @@ template <class ELFT> void lld::elf2::ma
>    }
>
>    // Preserve special sections.
> -  for (const std::unique_ptr<ObjectFile<ELFT>> &F :
> Symtab->getObjectFiles()) {
> -    for (InputSectionBase<ELFT> *Sec : F->getSections()) {
> -      if (!Sec || Sec == &InputSection<ELFT>::Discarded)
> -        continue;
> -      if (isReserved(Sec))
> -        Enqueue(Sec);
> -    }
> -  }
> +  for (const std::unique_ptr<ObjectFile<ELFT>> &F :
> Symtab->getObjectFiles())
> +    for (InputSectionBase<ELFT> *Sec : F->getSections())
> +      if (Sec && Sec != &InputSection<ELFT>::Discarded)
> +        if (isReserved(Sec))
>

Any reason not to roll all 3 conditions into one if? Seems a bit arbitrary
to searate the isReserved condition from the other two.


> +          Enqueue(Sec);
>
>    // Mark all reachable sections.
>    while (!Q.empty())
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160111/06572028/attachment.html>


More information about the llvm-commits mailing list