[lld] r281917 - [Writer] Rename variables to reflect reality. NFCI.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 10:38:39 PDT 2016


Author: davide
Date: Mon Sep 19 12:38:39 2016
New Revision: 281917

URL: http://llvm.org/viewvc/llvm-project?rev=281917&view=rev
Log:
[Writer] Rename variables to reflect reality. NFCI.

The InputSection variables in the Writer were named `C`. This
was because when the ELF linker was ported (from COFF)
the name `Chunks` for input sections was retained.
Luckily we switched to a more ELF-compliant jargon, but these
variables weren't reanamed accordingly during the transition.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=281917&r1=281916&r2=281917&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon Sep 19 12:38:39 2016
@@ -653,22 +653,22 @@ void Writer<ELFT>::forEachRelSec(
     std::function<void(InputSectionBase<ELFT> &, const typename ELFT::Shdr &)>
         Fn) {
   for (elf::ObjectFile<ELFT> *F : Symtab<ELFT>::X->getObjectFiles()) {
-    for (InputSectionBase<ELFT> *C : F->getSections()) {
-      if (isDiscarded(C))
+    for (InputSectionBase<ELFT> *IS : F->getSections()) {
+      if (isDiscarded(IS))
         continue;
       // Scan all relocations. Each relocation goes through a series
       // of tests to determine if it needs special treatment, such as
       // creating GOT, PLT, copy relocations, etc.
       // Note that relocations for non-alloc sections are directly
       // processed by InputSection::relocateNonAlloc.
-      if (!(C->getSectionHdr()->sh_flags & SHF_ALLOC))
+      if (!(IS->getSectionHdr()->sh_flags & SHF_ALLOC))
         continue;
-      if (auto *S = dyn_cast<InputSection<ELFT>>(C)) {
+      if (auto *S = dyn_cast<InputSection<ELFT>>(IS)) {
         for (const Elf_Shdr *RelSec : S->RelocSections)
           Fn(*S, *RelSec);
         continue;
       }
-      if (auto *S = dyn_cast<EhInputSection<ELFT>>(C))
+      if (auto *S = dyn_cast<EhInputSection<ELFT>>(IS))
         if (S->RelocSection)
           Fn(*S, *S->RelocSection);
     }
@@ -677,17 +677,17 @@ void Writer<ELFT>::forEachRelSec(
 
 template <class ELFT> void Writer<ELFT>::createSections() {
   for (elf::ObjectFile<ELFT> *F : Symtab<ELFT>::X->getObjectFiles()) {
-    for (InputSectionBase<ELFT> *C : F->getSections()) {
-      if (isDiscarded(C)) {
-        reportDiscarded(C);
+    for (InputSectionBase<ELFT> *IS : F->getSections()) {
+      if (isDiscarded(IS)) {
+        reportDiscarded(IS);
         continue;
       }
       OutputSectionBase<ELFT> *Sec;
       bool IsNew;
-      std::tie(Sec, IsNew) = Factory.create(C, getOutputSectionName(C));
+      std::tie(Sec, IsNew) = Factory.create(IS, getOutputSectionName(IS));
       if (IsNew)
         OutputSections.push_back(Sec);
-      Sec->addSection(C);
+      Sec->addSection(IS);
     }
   }
 
@@ -821,9 +821,9 @@ template <class ELFT> bool Writer<ELFT>:
 
 // This function add Out<ELFT>::* sections to OutputSections.
 template <class ELFT> void Writer<ELFT>::addPredefinedSections() {
-  auto Add = [&](OutputSectionBase<ELFT> *C) {
-    if (C)
-      OutputSections.push_back(C);
+  auto Add = [&](OutputSectionBase<ELFT> *OS) {
+    if (OS)
+      OutputSections.push_back(OS);
   };
 
   // A core file does not usually contain unmodified segments except




More information about the llvm-commits mailing list