[lld] r299636 - [ELF] Remove unnecessary cast and fix comments. NFC.

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 02:40:04 PDT 2017


Author: jhenderson
Date: Thu Apr  6 04:40:03 2017
New Revision: 299636

URL: http://llvm.org/viewvc/llvm-project?rev=299636&view=rev
Log:
[ELF] Remove unnecessary cast and fix comments. 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=299636&r1=299635&r2=299636&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Thu Apr  6 04:40:03 2017
@@ -1036,7 +1036,7 @@ static void applySynthetic(const std::ve
 // We need to add input synthetic sections early in createSyntheticSections()
 // to make them visible from linkescript side. But not all sections are always
 // required to be in output. For example we don't need dynamic section content
-// sometimes. This function filters out such unused sections from output.
+// sometimes. This function filters out such unused sections from the output.
 static void removeUnusedSyntheticSections(std::vector<OutputSection *> &V) {
   // All input synthetic sections that can be empty are placed after
   // all regular ones. We iterate over them all and exit at first
@@ -1048,12 +1048,12 @@ static void removeUnusedSyntheticSection
     if (!SS->empty() || !SS->OutSec)
       continue;
 
-    OutputSection *OutSec = cast<OutputSection>(SS->OutSec);
-    OutSec->Sections.erase(
-        std::find(OutSec->Sections.begin(), OutSec->Sections.end(), SS));
-    // If there is no other sections in output section, remove it from output.
-    if (OutSec->Sections.empty())
-      V.erase(std::find(V.begin(), V.end(), OutSec));
+    SS->OutSec->Sections.erase(std::find(SS->OutSec->Sections.begin(),
+                                         SS->OutSec->Sections.end(), SS));
+    // If there are no other sections in the output section, remove it from the
+    // output.
+    if (SS->OutSec->Sections.empty())
+      V.erase(std::find(V.begin(), V.end(), SS->OutSec));
   }
 }
 




More information about the llvm-commits mailing list