diff options
author | Alexey Samsonov <samsonov@google.com> | 2014-04-30 22:17:38 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2014-04-30 22:17:38 +0000 |
commit | 846781235d0c027702e2c528a6660ec14ca8edcd (patch) | |
tree | 30d199a2f92353f75a2999963407574de30c1343 /lib/CodeGen/LexicalScopes.cpp | |
parent | fff0879df07ce0f449b00a9ed4b3d7732735bc4e (diff) | |
download | llvm-846781235d0c027702e2c528a6660ec14ca8edcd.tar.gz llvm-846781235d0c027702e2c528a6660ec14ca8edcd.tar.bz2 llvm-846781235d0c027702e2c528a6660ec14ca8edcd.tar.xz |
Convert more loops to range-based equivalents
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LexicalScopes.cpp')
-rw-r--r-- | lib/CodeGen/LexicalScopes.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/CodeGen/LexicalScopes.cpp b/lib/CodeGen/LexicalScopes.cpp index f87b890039..f01dec28e5 100644 --- a/lib/CodeGen/LexicalScopes.cpp +++ b/lib/CodeGen/LexicalScopes.cpp @@ -63,25 +63,22 @@ void LexicalScopes::extractLexicalScopes( const MachineInstr *RangeBeginMI = nullptr; const MachineInstr *PrevMI = nullptr; DebugLoc PrevDL; - for (MachineBasicBlock::const_iterator II = MBB.begin(), IE = MBB.end(); - II != IE; ++II) { - const MachineInstr *MInsn = II; - + for (const auto &MInsn : MBB) { // Check if instruction has valid location information. - const DebugLoc MIDL = MInsn->getDebugLoc(); + const DebugLoc MIDL = MInsn.getDebugLoc(); if (MIDL.isUnknown()) { - PrevMI = MInsn; + PrevMI = &MInsn; continue; } // If scope has not changed then skip this instruction. if (MIDL == PrevDL) { - PrevMI = MInsn; + PrevMI = &MInsn; continue; } // Ignore DBG_VALUE. It does not contribute to any instruction in output. - if (MInsn->isDebugValue()) + if (MInsn.isDebugValue()) continue; if (RangeBeginMI) { @@ -94,10 +91,10 @@ void LexicalScopes::extractLexicalScopes( } // This is a beginning of a new instruction range. - RangeBeginMI = MInsn; + RangeBeginMI = &MInsn; // Reset previous markers. - PrevMI = MInsn; + PrevMI = &MInsn; PrevDL = MIDL; } |