From f74bde67353df69385c266cee3ba310fa0392d90 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Wed, 30 Apr 2014 22:17:38 +0000 Subject: Convert more loops to range-based equivalents llvm-svn: 207714 --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 8de084abff1..d3309c1e6e8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1441,23 +1441,21 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { // Collect user variables, find the end of the prologue. for (const auto &MBB : *MF) { - for (MachineBasicBlock::const_iterator II = MBB.begin(), IE = MBB.end(); - II != IE; ++II) { - const MachineInstr *MI = II; - if (MI->isDebugValue()) { - assert(MI->getNumOperands() > 1 && "Invalid machine instruction!"); + for (const auto &MI : MBB) { + if (MI.isDebugValue()) { + assert(MI.getNumOperands() > 1 && "Invalid machine instruction!"); // Keep track of user variables in order of appearance. Store the set // of variables we've already seen as a set of keys in DbgValues. - const MDNode *Var = MI->getDebugVariable(); + const MDNode *Var = MI.getDebugVariable(); auto IterPair = DbgValues.insert( std::make_pair(Var, SmallVector())); if (IterPair.second) UserVariables.push_back(Var); - } else if (!MI->getFlag(MachineInstr::FrameSetup) && - PrologEndLoc.isUnknown() && !MI->getDebugLoc().isUnknown()) { + } else if (!MI.getFlag(MachineInstr::FrameSetup) && + PrologEndLoc.isUnknown() && !MI.getDebugLoc().isUnknown()) { // First known non-DBG_VALUE and non-frame setup location marks // the beginning of the function body. - PrologEndLoc = MI->getDebugLoc(); + PrologEndLoc = MI.getDebugLoc(); } } } -- cgit v1.2.3