diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index fdb81b05d9490..4aaa96c81bbc1 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2878,17 +2878,16 @@ void AsmPrinter::emitConstantPool() { // Now print stuff into the calculated sections. const MCSection *CurSection = nullptr; unsigned Offset = 0; - for (unsigned i = 0, e = CPSections.size(); i != e; ++i) { - for (unsigned j = 0, ee = CPSections[i].CPEs.size(); j != ee; ++j) { - unsigned CPI = CPSections[i].CPEs[j]; + for (const SectionCPs &CPSection : CPSections) { + for (unsigned CPI : CPSection.CPEs) { MCSymbol *Sym = GetCPISymbol(CPI); if (!Sym->isUndefined()) continue; - if (CurSection != CPSections[i].S) { - OutStreamer->switchSection(CPSections[i].S); - emitAlignment(Align(CPSections[i].Alignment)); - CurSection = CPSections[i].S; + if (CurSection != CPSection.S) { + OutStreamer->switchSection(CPSection.S); + emitAlignment(Align(CPSection.Alignment)); + CurSection = CPSection.S; Offset = 0; }