[lld] r355954 - ELF: Simplify. NFCI.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 12:19:23 PDT 2019


Author: pcc
Date: Tue Mar 12 12:19:23 2019
New Revision: 355954

URL: http://llvm.org/viewvc/llvm-project?rev=355954&view=rev
Log:
ELF: Simplify. NFCI.

We don't need to take a slice of SectionCommands in addOrphanSections()
because it is not modified until the end of the function.

Differential Revision: https://reviews.llvm.org/D59239

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=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Mar 12 12:19:23 2019
@@ -636,7 +636,6 @@ static OutputSection *addInputSec(String
 
 // Add sections that didn't match any sections command.
 void LinkerScript::addOrphanSections() {
-  unsigned End = SectionCommands.size();
   StringMap<OutputSection *> Map;
   std::vector<OutputSection *> V;
 
@@ -651,8 +650,7 @@ void LinkerScript::addOrphanSections() {
     else if (Config->OrphanHandling == OrphanHandlingPolicy::Warn)
       warn(toString(S) + " is being placed in '" + Name + "'");
 
-    if (OutputSection *Sec =
-            findByName(makeArrayRef(SectionCommands).slice(0, End), Name)) {
+    if (OutputSection *Sec = findByName(SectionCommands, Name)) {
       Sec->addSection(cast<InputSection>(S));
       return;
     }




More information about the llvm-commits mailing list