From: Javed Absar Date: Tue, 29 Aug 2017 10:04:18 +0000 (+0000) Subject: [ARM] - Tidy-up ARMAsmPrinter.cpp X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a403b9fa770dc985aca7d326ecf958f424936fc3;p=llvm [ARM] - Tidy-up ARMAsmPrinter.cpp Change to range-loop where missing. Reviwewed by: @fhahn, @asb Differential Revision: https://reviews.llvm.org/D37199 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311993 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp index 9494be1ae0e..8e425ddcdad 100644 --- a/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/ARMAsmPrinter.cpp @@ -173,10 +173,10 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) { if (! ThumbIndirectPads.empty()) { OutStreamer->EmitAssemblerFlag(MCAF_Code16); EmitAlignment(1); - for (unsigned i = 0, e = ThumbIndirectPads.size(); i < e; i++) { - OutStreamer->EmitLabel(ThumbIndirectPads[i].second); + for (std::pair &TIP : ThumbIndirectPads) { + OutStreamer->EmitLabel(TIP.second); EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tBX) - .addReg(ThumbIndirectPads[i].first) + .addReg(TIP.first) // Add predicate operands. .addImm(ARMCC::AL) .addReg(0)); @@ -945,8 +945,7 @@ void ARMAsmPrinter::EmitJumpTableAddrs(const MachineInstr *MI) { const std::vector &JT = MJTI->getJumpTables(); const std::vector &JTBBs = JT[JTI].MBBs; - for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) { - MachineBasicBlock *MBB = JTBBs[i]; + for (MachineBasicBlock *MBB : JTBBs) { // Construct an MCExpr for the entry. We want a value of the form: // (BasicBlockAddr - TableBeginAddr) // @@ -989,8 +988,7 @@ void ARMAsmPrinter::EmitJumpTableInsts(const MachineInstr *MI) { const std::vector &JT = MJTI->getJumpTables(); const std::vector &JTBBs = JT[JTI].MBBs; - for (unsigned i = 0, e = JTBBs.size(); i != e; ++i) { - MachineBasicBlock *MBB = JTBBs[i]; + for (MachineBasicBlock *MBB : JTBBs) { const MCExpr *MBBSymbolExpr = MCSymbolRefExpr::create(MBB->getSymbol(), OutContext); // If this isn't a TBB or TBH, the entries are direct branch instructions. @@ -1289,9 +1287,9 @@ void ARMAsmPrinter::EmitInstruction(const MachineInstr *MI) { unsigned TReg = MI->getOperand(0).getReg(); MCSymbol *TRegSym = nullptr; - for (unsigned i = 0, e = ThumbIndirectPads.size(); i < e; i++) { - if (ThumbIndirectPads[i].first == TReg) { - TRegSym = ThumbIndirectPads[i].second; + for (std::pair &TIP : ThumbIndirectPads) { + if (TIP.first == TReg) { + TRegSym = TIP.second; break; } }