[llvm] r238676 - [MC] Simplify code. No functionality change intended.

Benjamin Kramer benny.kra at googlemail.com
Sun May 31 11:49:29 PDT 2015


Author: d0k
Date: Sun May 31 13:49:28 2015
New Revision: 238676

URL: http://llvm.org/viewvc/llvm-project?rev=238676&view=rev
Log:
[MC] Simplify code. No functionality change intended.

Modified:
    llvm/trunk/lib/MC/MCContext.cpp

Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=238676&r1=238675&r2=238676&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Sun May 31 13:49:28 2015
@@ -447,13 +447,8 @@ bool MCContext::isValidDwarfFileNumber(u
 /// 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 {





More information about the llvm-commits mailing list