[lld] r312787 - [ELF] - Simplify. NFC.

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


Author: grimar
Date: Fri Sep  8 06:26:45 2017
New Revision: 312787

URL: http://llvm.org/viewvc/llvm-project?rev=312787&view=rev
Log:
[ELF] - Simplify. 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=312787&r1=312786&r2=312787&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Sep  8 06:26:45 2017
@@ -1205,9 +1205,8 @@ static void removeUnusedSyntheticSection
     for (auto I = OS->Commands.begin(), E = OS->Commands.end(); I != E; ++I) {
       BaseCommand *B = *I;
       if (auto *ISD = dyn_cast<InputSectionDescription>(B)) {
-        auto P = std::find(ISD->Sections.begin(), ISD->Sections.end(), SS);
-        if (P != ISD->Sections.end())
-          ISD->Sections.erase(P);
+        llvm::erase_if(ISD->Sections,
+                       [=](InputSection *IS) { return IS == SS; });
         if (ISD->Sections.empty())
           Empty = I;
       }




More information about the llvm-commits mailing list