[lld] r312789 - [ELF] - Simplify #2. NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 06:40:07 PDT 2017


Author: grimar
Date: Fri Sep  8 06:40:07 2017
New Revision: 312789

URL: http://llvm.org/viewvc/llvm-project?rev=312789&view=rev
Log:
[ELF] - Simplify #2. 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=312789&r1=312788&r2=312789&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Sep  8 06:40:07 2017
@@ -1216,14 +1216,9 @@ static void removeUnusedSyntheticSection
 
     // If there are no other sections in the output section, remove it from the
     // output.
-    if (OS->Commands.empty()) {
-      // Also remove script commands matching the output section.
-      llvm::erase_if(Script->Opt.Commands, [&](BaseCommand *Cmd) {
-        if (auto *Sec = dyn_cast<OutputSection>(Cmd))
-          return Sec == OS;
-        return false;
-      });
-    }
+    if (OS->Commands.empty())
+      llvm::erase_if(Script->Opt.Commands,
+                     [&](BaseCommand *Cmd) { return Cmd == OS; });
   }
 }
 




More information about the llvm-commits mailing list