@@ -222,17 +222,13 @@ void LexicalScopes::constructScopeNest(LexicalScope *Scope) {
222
222
LexicalScope *WS = WorkStack.back ();
223
223
const SmallVectorImpl<LexicalScope *> &Children = WS->getChildren ();
224
224
bool visitedChildren = false ;
225
- for (SmallVectorImpl<LexicalScope *>::const_iterator SI = Children.begin (),
226
- SE = Children.end ();
227
- SI != SE; ++SI) {
228
- LexicalScope *ChildScope = *SI;
225
+ for (auto &ChildScope : Children)
229
226
if (!ChildScope->getDFSOut ()) {
230
227
WorkStack.push_back (ChildScope);
231
228
visitedChildren = true ;
232
229
ChildScope->setDFSIn (++Counter);
233
230
break ;
234
231
}
235
- }
236
232
if (!visitedChildren) {
237
233
WorkStack.pop_back ();
238
234
WS->setDFSOut (++Counter);
@@ -247,10 +243,7 @@ void LexicalScopes::assignInstructionRanges(
247
243
DenseMap<const MachineInstr *, LexicalScope *> &MI2ScopeMap) {
248
244
249
245
LexicalScope *PrevLexicalScope = nullptr ;
250
- for (SmallVectorImpl<InsnRange>::const_iterator RI = MIRanges.begin (),
251
- RE = MIRanges.end ();
252
- RI != RE; ++RI) {
253
- const InsnRange &R = *RI;
246
+ for (const auto &R : MIRanges) {
254
247
LexicalScope *S = MI2ScopeMap.lookup (R.first );
255
248
assert (S && " Lost LexicalScope for a machine instruction!" );
256
249
if (PrevLexicalScope && !PrevLexicalScope->dominates (S))
@@ -281,12 +274,8 @@ void LexicalScopes::getMachineBasicBlocks(
281
274
}
282
275
283
276
SmallVectorImpl<InsnRange> &InsnRanges = Scope->getRanges ();
284
- for (SmallVectorImpl<InsnRange>::iterator I = InsnRanges.begin (),
285
- E = InsnRanges.end ();
286
- I != E; ++I) {
287
- InsnRange &R = *I;
277
+ for (auto &R : InsnRanges)
288
278
MBBs.insert (R.first ->getParent ());
289
- }
290
279
}
291
280
292
281
// / dominates - Return true if DebugLoc's lexical scope dominates at least one
@@ -301,9 +290,8 @@ bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) {
301
290
return true ;
302
291
303
292
bool Result = false ;
304
- for (MachineBasicBlock::iterator I = MBB->begin (), E = MBB->end (); I != E;
305
- ++I) {
306
- if (const DILocation *IDL = I->getDebugLoc ())
293
+ for (auto &I : *MBB) {
294
+ if (const DILocation *IDL = I.getDebugLoc ())
307
295
if (LexicalScope *IScope = getOrCreateLexicalScope (IDL))
308
296
if (Scope->dominates (IScope))
309
297
return true ;
0 commit comments