[llvm] r251952 - Move code out of a loop and use a range loop.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 10:04:07 PST 2015


Author: rafael
Date: Tue Nov  3 12:04:07 2015
New Revision: 251952

URL: http://llvm.org/viewvc/llvm-project?rev=251952&view=rev
Log:
Move code out of a loop and use a range loop.

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

Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=251952&r1=251951&r2=251952&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCELFStreamer.cpp Tue Nov  3 12:04:07 2015
@@ -619,16 +619,14 @@ void MCELFStreamer::EmitBundleUnlock() {
 }
 
 void MCELFStreamer::Flush() {
-  for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
-                                                e = LocalCommons.end();
-       i != e; ++i) {
-    const MCSymbol &Symbol = *i->Symbol;
-    uint64_t Size = i->Size;
-    unsigned ByteAlignment = i->ByteAlignment;
-    MCSection &Section = *getAssembler().getContext().getELFSection(
-        ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
+  MCSection &Section = *getAssembler().getContext().getELFSection(
+      ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
+  getAssembler().registerSection(Section);
 
-    getAssembler().registerSection(Section);
+  for (const LocalCommon &L : LocalCommons) {
+    const MCSymbol &Symbol = *L.Symbol;
+    uint64_t Size = L.Size;
+    unsigned ByteAlignment = L.ByteAlignment;
     new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &Section);
 
     MCFragment *F = new MCFillFragment(0, 0, Size, &Section);




More information about the llvm-commits mailing list