[lld] r248590 - Move variables closer to use. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 10:32:37 PDT 2015


Author: rafael
Date: Fri Sep 25 12:32:37 2015
New Revision: 248590

URL: http://llvm.org/viewvc/llvm-project?rev=248590&view=rev
Log:
Move variables closer to use. NFC.

Modified:
    lld/trunk/ELF/OutputSections.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=248590&r1=248589&r2=248590&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Fri Sep 25 12:32:37 2015
@@ -367,8 +367,6 @@ SymbolTableSection<ELFT>::SymbolTableSec
 }
 
 template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
-  const OutputSection<ELFT> *Out = nullptr;
-  const InputSection<ELFT> *Section = nullptr;
   Buf += sizeof(Elf_Sym);
 
   // All symbols with STB_LOCAL binding precede the weak and global symbols.
@@ -391,9 +389,9 @@ template <class ELFT> void SymbolTableSe
           SecIndex = File.getObj().getExtendedSymbolTableIndex(
               &Sym, File.getSymbolTable(), File.getSymbolTableShndx());
         ArrayRef<InputSection<ELFT> *> Sections = File.getSections();
-        Section = Sections[SecIndex];
+        const InputSection<ELFT> *Section = Sections[SecIndex];
         assert(Section != nullptr);
-        Out = Section->getOutputSection();
+        const OutputSection<ELFT> *Out = Section->getOutputSection();
         assert(Out != nullptr);
         ESym->st_shndx = Out->getSectionIndex();
         ESym->st_value =
@@ -416,8 +414,8 @@ template <class ELFT> void SymbolTableSe
     auto *ESym = reinterpret_cast<Elf_Sym *>(Buf);
     ESym->st_name = StrTabSec.getFileOff(Name);
 
-    Out = nullptr;
-    Section = nullptr;
+    const OutputSection<ELFT> *Out = nullptr;
+    const InputSection<ELFT> *Section = nullptr;
 
     switch (Body->kind()) {
     case SymbolBody::DefinedRegularKind:




More information about the llvm-commits mailing list