[lld] r289748 - Rename this variable.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 17:13:08 PST 2016


We have a notion of "chunk" in COFF, and when we ported LLD/COFF to ELF
that notion was used to represent ELF sections. After that we removed Chunk
class from ELF, but we can still find remains of it in variable names.
That's why it was named SC (short for section chunk).

On Wed, Dec 14, 2016 at 4:57 PM, Sean Silva via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: silvas
> Date: Wed Dec 14 18:57:53 2016
> New Revision: 289748
>
> URL: http://llvm.org/viewvc/llvm-project?rev=289748&view=rev
> Log:
> Rename this variable.
>
> `SC` didn't make much sense. We don't seem to have a clear convention,
> but `IS` sounds good here because it emphasizes that it is an input
> section (this is one place in the code where we are dealing with both
> input sections and output sections at the same time so that extra
> emphasis makes it a bit clearer).
>
> Modified:
>     lld/trunk/ELF/Symbols.cpp
>
> Modified: lld/trunk/ELF/Symbols.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.
> cpp?rev=289748&r1=289747&r2=289748&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/Symbols.cpp (original)
> +++ lld/trunk/ELF/Symbols.cpp Wed Dec 14 18:57:53 2016
> @@ -44,17 +44,17 @@ static typename ELFT::uint getSymVA(cons
>    }
>    case SymbolBody::DefinedRegularKind: {
>      auto &D = cast<DefinedRegular<ELFT>>(Body);
> -    InputSectionBase<ELFT> *SC = D.Section;
> +    InputSectionBase<ELFT> *IS = D.Section;
>
>      // According to the ELF spec reference to a local symbol from outside
>      // the group are not allowed. Unfortunately .eh_frame breaks that rule
>      // and must be treated specially. For now we just replace the symbol
> with
>      // 0.
> -    if (SC == &InputSection<ELFT>::Discarded)
> +    if (IS == &InputSection<ELFT>::Discarded)
>        return 0;
>
>      // This is an absolute symbol.
> -    if (!SC)
> +    if (!IS)
>        return D.Value;
>
>      uintX_t Offset = D.Value;
> @@ -62,7 +62,7 @@ static typename ELFT::uint getSymVA(cons
>        Offset += Addend;
>        Addend = 0;
>      }
> -    uintX_t VA = (SC->OutSec ? SC->OutSec->Addr : 0) +
> SC->getOffset(Offset);
> +    uintX_t VA = (IS->OutSec ? IS->OutSec->Addr : 0) +
> IS->getOffset(Offset);
>      if (D.isTls() && !Config->Relocatable) {
>        if (!Out<ELFT>::TlsPhdr)
>          fatal(toString(D.File) +
>
>
> _______________________________________________
> 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/20161214/b27b23c0/attachment.html>


More information about the llvm-commits mailing list