[lld] r246085 - Define types close to use. NFC.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 14:42:36 PDT 2015


Author: rafael
Date: Wed Aug 26 16:42:36 2015
New Revision: 246085

URL: http://llvm.org/viewvc/llvm-project?rev=246085&view=rev
Log:
Define types close to use. NFC.

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=246085&r1=246084&r2=246085&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Aug 26 16:42:36 2015
@@ -235,9 +235,7 @@ template <class ELFT> void SymbolTableSe
 
     auto *ESym = reinterpret_cast<Elf_Sym *>(Buf);
     ESym->st_name = Builder.getOffset(Name);
-    uint8_t Binding = 0;
     SymbolBody *Body = Sym->Body;
-    uint8_t Type = 0;
 
     const SectionChunk<ELFT> *Section = nullptr;
     const Elf_Sym *InputSym = nullptr;
@@ -259,10 +257,10 @@ template <class ELFT> void SymbolTableSe
     }
 
     if (InputSym) {
-      Type = InputSym->getType();
-      Binding = InputSym->getBinding();
+      uint8_t Type = InputSym->getType();
+      uint8_t Binding = InputSym->getBinding();
+      ESym->setBindingAndType(Binding, Type);
     }
-    ESym->setBindingAndType(Binding, Type);
 
     if (Section) {
       OutputSection<ELFT> *Out = Section->getOutputSection();




More information about the llvm-commits mailing list