Convert more loops to range-based equivalents

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207714 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alexey Samsonov
2014-04-30 22:17:38 +00:00
parent fff0879df0
commit 846781235d
13 changed files with 103 additions and 130 deletions

View File

@ -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<const MachineInstr *, 4>()));
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();
}
}
}