[MC] Simplify code. No functionality change intended.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 31 May 2015 18:49:28 +0000 (18:49 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 31 May 2015 18:49:28 +0000 (18:49 +0000)
llvm-svn: 238676

llvm/lib/MC/MCContext.cpp

index 1f2f034..5756da3 100644 (file)
@@ -447,13 +447,8 @@ bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
 /// Remove empty sections from SectionStartEndSyms, to avoid generating
 /// useless debug info for them.
 void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
-  std::vector<MCSection *> Keep;
-  for (MCSection *Sec : SectionsForRanges) {
-    if (MCOS.mayHaveInstructions(*Sec))
-      Keep.push_back(Sec);
-  }
-  SectionsForRanges.clear();
-  SectionsForRanges.insert(Keep.begin(), Keep.end());
+  SectionsForRanges.remove_if(
+      [&](MCSection *Sec) { return !MCOS.mayHaveInstructions(*Sec); });
 }
 
 void MCContext::reportFatalError(SMLoc Loc, const Twine &Msg) const {