Move code out of a loop and use a range loop.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 3 Nov 2015 18:04:07 +0000 (18:04 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 3 Nov 2015 18:04:07 +0000 (18:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251952 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCELFStreamer.cpp

index fc4f8a6281b41e1687de09ae59008bfd39a24e96..12cf06cbe5c5592adb27052ad4ddc7a8f61db2c0 100644 (file)
@@ -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);
-
-    getAssembler().registerSection(Section);
+  MCSection &Section = *getAssembler().getContext().getELFSection(
+      ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
+  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);