[lld] r313522 - [ELF] - Simplify adjustSectionsBeforeSorting().

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 18 01:43:44 PDT 2017


Author: grimar
Date: Mon Sep 18 01:43:44 2017
New Revision: 313522

URL: http://llvm.org/viewvc/llvm-project?rev=313522&view=rev
Log:
[ELF] - Simplify adjustSectionsBeforeSorting().

Does not seem we need to set SectionIndex here.
It is set in finalizeSections() later.

Differential revision: https://reviews.llvm.org/D37815

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=313522&r1=313521&r2=313522&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Mon Sep 18 01:43:44 2017
@@ -668,8 +668,8 @@ void LinkerScript::adjustSectionsBeforeS
   // consequeces and gives us a section to put the symbol in.
   uint64_t Flags = SHF_ALLOC;
 
-  for (int I = 0, E = Opt.Commands.size(); I != E; ++I) {
-    auto *Sec = dyn_cast<OutputSection>(Opt.Commands[I]);
+  for (BaseCommand * Cmd : Opt.Commands) {
+    auto *Sec = dyn_cast<OutputSection>(Cmd);
     if (!Sec)
       continue;
     if (Sec->Live) {
@@ -681,7 +681,6 @@ void LinkerScript::adjustSectionsBeforeS
       continue;
 
     Sec->Live = true;
-    Sec->SectionIndex = I;
     Sec->Flags = Flags;
   }
 }




More information about the llvm-commits mailing list