Move code out of a loop and use a range loop.

llvm-svn: 251952
This commit is contained in:
Rafael Espindola 2015-11-03 18:04:07 +00:00
parent 53feb8c10b
commit e0550a80a4
1 changed files with 7 additions and 9 deletions

View File

@ -619,16 +619,14 @@ void MCELFStreamer::EmitBundleUnlock() {
} }
void MCELFStreamer::Flush() { void MCELFStreamer::Flush() {
for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(), MCSection &Section = *getAssembler().getContext().getELFSection(
e = LocalCommons.end(); ".bss", ELF::SHT_NOBITS, ELF::SHF_WRITE | ELF::SHF_ALLOC);
i != e; ++i) { getAssembler().registerSection(Section);
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); 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); new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &Section);
MCFragment *F = new MCFillFragment(0, 0, Size, &Section); MCFragment *F = new MCFillFragment(0, 0, Size, &Section);