[lld] r345138 - Make a local variable scope narrower. NFC.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 06:42:34 PDT 2018


Author: ruiu
Date: Wed Oct 24 06:42:33 2018
New Revision: 345138

URL: http://llvm.org/viewvc/llvm-project?rev=345138&view=rev
Log:
Make a local variable scope narrower. 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=345138&r1=345137&r2=345138&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Oct 24 06:42:33 2018
@@ -1675,9 +1675,9 @@ template <class ELFT> void Writer<ELFT>:
   // particularly relevant.
   Out::ElfHeader->SectionIndex = 1;
 
-  unsigned I = 1;
-  for (OutputSection *Sec : OutputSections) {
-    Sec->SectionIndex = I++;
+  for (size_t I = 0, E = OutputSections.size(); I != E; ++I) {
+    OutputSection *Sec = OutputSections[I];
+    Sec->SectionIndex = I + 1;
     Sec->ShName = In.ShStrTab->addString(Sec->Name);
   }
 




More information about the llvm-commits mailing list