From: Rafael Espindola Date: Tue, 3 Nov 2015 18:04:07 +0000 (+0000) Subject: Move code out of a loop and use a range loop. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f026f70e798852f9eae20bfdb15266f94d7ee9f2;p=oota-llvm.git Move code out of a loop and use a range loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251952 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp index fc4f8a6281b..12cf06cbe5c 100644 --- a/lib/MC/MCELFStreamer.cpp +++ b/lib/MC/MCELFStreamer.cpp @@ -619,16 +619,14 @@ void MCELFStreamer::EmitBundleUnlock() { } void MCELFStreamer::Flush() { - for (std::vector::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);