[ELF] - Simplify (use llvm::erase_if). NFC.

llvm-svn: 311878
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index a870aa2..c9f43b8 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -642,13 +642,11 @@
   // clutter the output.
   // We instead remove trivially empty sections. The bfd linker seems even
   // more aggressive at removing them.
-  auto Pos = std::remove_if(Opt.Commands.begin(), Opt.Commands.end(),
-                            [&](BaseCommand *Base) {
-                              if (auto *Sec = dyn_cast<OutputSection>(Base))
-                                return !Sec->Live;
-                              return false;
-                            });
-  Opt.Commands.erase(Pos, Opt.Commands.end());
+  llvm::erase_if(Opt.Commands, [&](BaseCommand *Base) {
+    if (auto *Sec = dyn_cast<OutputSection>(Base))
+      return !Sec->Live;
+    return false;
+  });
 }
 
 static bool isAllSectionDescription(const OutputSection &Cmd) {
@@ -778,10 +776,8 @@
     Phdrs.erase(It);
   }
 
-  auto PhdrI = llvm::find_if(
-      Phdrs, [](const PhdrEntry *E) { return E->p_type == PT_PHDR; });
-  if (PhdrI != Phdrs.end())
-    Phdrs.erase(PhdrI);
+  llvm::erase_if(Phdrs,
+                 [](const PhdrEntry *E) { return E->p_type == PT_PHDR; });
 }
 
 LinkerScript::AddressState::AddressState(const ScriptConfiguration &Opt) {