@@ -200,16 +200,15 @@ void ModuleList::ReplaceEquivalent(
200
200
}
201
201
}
202
202
203
- bool ModuleList::AppendIfNeeded (const ModuleSP &module_sp , bool notify) {
204
- if (module_sp ) {
203
+ bool ModuleList::AppendIfNeeded (const ModuleSP &new_module , bool notify) {
204
+ if (new_module ) {
205
205
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
206
- collection::iterator pos, end = m_modules.end ();
207
- for (pos = m_modules.begin (); pos != end; ++pos) {
208
- if (pos->get () == module_sp.get ())
206
+ for (const ModuleSP &module_sp : m_modules) {
207
+ if (module_sp.get () == new_module.get ())
209
208
return false ; // Already in the list
210
209
}
211
210
// Only push module_sp on the list if it wasn't already in there.
212
- Append (module_sp , notify);
211
+ Append (new_module , notify);
213
212
return true ;
214
213
}
215
214
return false ;
@@ -372,10 +371,10 @@ void ModuleList::FindFunctions(ConstString name,
372
371
Module::LookupInfo lookup_info (name, name_type_mask, eLanguageTypeUnknown);
373
372
374
373
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
375
- collection::const_iterator pos, end = m_modules. end ();
376
- for (pos = m_modules. begin (); pos != end; ++pos) {
377
- (*pos)-> FindFunctions (lookup_info. GetLookupName (), CompilerDeclContext (),
378
- lookup_info.GetNameTypeMask (), options, sc_list);
374
+ for ( const ModuleSP &module_sp : m_modules) {
375
+ module_sp-> FindFunctions (lookup_info. GetLookupName (),
376
+ CompilerDeclContext (),
377
+ lookup_info.GetNameTypeMask (), options, sc_list);
379
378
}
380
379
381
380
const size_t new_size = sc_list.GetSize ();
@@ -384,10 +383,9 @@ void ModuleList::FindFunctions(ConstString name,
384
383
lookup_info.Prune (sc_list, old_size);
385
384
} else {
386
385
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
387
- collection::const_iterator pos, end = m_modules.end ();
388
- for (pos = m_modules.begin (); pos != end; ++pos) {
389
- (*pos)->FindFunctions (name, CompilerDeclContext (), name_type_mask,
390
- options, sc_list);
386
+ for (const ModuleSP &module_sp : m_modules) {
387
+ module_sp->FindFunctions (name, CompilerDeclContext (), name_type_mask,
388
+ options, sc_list);
391
389
}
392
390
}
393
391
}
@@ -401,10 +399,9 @@ void ModuleList::FindFunctionSymbols(ConstString name,
401
399
Module::LookupInfo lookup_info (name, name_type_mask, eLanguageTypeUnknown);
402
400
403
401
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
404
- collection::const_iterator pos, end = m_modules.end ();
405
- for (pos = m_modules.begin (); pos != end; ++pos) {
406
- (*pos)->FindFunctionSymbols (lookup_info.GetLookupName (),
407
- lookup_info.GetNameTypeMask (), sc_list);
402
+ for (const ModuleSP &module_sp : m_modules) {
403
+ module_sp->FindFunctionSymbols (lookup_info.GetLookupName (),
404
+ lookup_info.GetNameTypeMask (), sc_list);
408
405
}
409
406
410
407
const size_t new_size = sc_list.GetSize ();
@@ -413,9 +410,8 @@ void ModuleList::FindFunctionSymbols(ConstString name,
413
410
lookup_info.Prune (sc_list, old_size);
414
411
} else {
415
412
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
416
- collection::const_iterator pos, end = m_modules.end ();
417
- for (pos = m_modules.begin (); pos != end; ++pos) {
418
- (*pos)->FindFunctionSymbols (name, name_type_mask, sc_list);
413
+ for (const ModuleSP &module_sp : m_modules) {
414
+ module_sp->FindFunctionSymbols (name, name_type_mask, sc_list);
419
415
}
420
416
}
421
417
}
@@ -424,65 +420,54 @@ void ModuleList::FindFunctions(const RegularExpression &name,
424
420
const ModuleFunctionSearchOptions &options,
425
421
SymbolContextList &sc_list) {
426
422
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
427
- collection::const_iterator pos, end = m_modules.end ();
428
- for (pos = m_modules.begin (); pos != end; ++pos) {
429
- (*pos)->FindFunctions (name, options, sc_list);
430
- }
423
+ for (const ModuleSP &module_sp : m_modules)
424
+ module_sp->FindFunctions (name, options, sc_list);
431
425
}
432
426
433
427
void ModuleList::FindCompileUnits (const FileSpec &path,
434
428
SymbolContextList &sc_list) const {
435
429
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
436
- collection::const_iterator pos, end = m_modules.end ();
437
- for (pos = m_modules.begin (); pos != end; ++pos) {
438
- (*pos)->FindCompileUnits (path, sc_list);
439
- }
430
+ for (const ModuleSP &module_sp : m_modules)
431
+ module_sp->FindCompileUnits (path, sc_list);
440
432
}
441
433
442
434
void ModuleList::FindGlobalVariables (ConstString name, size_t max_matches,
443
435
VariableList &variable_list) const {
444
436
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
445
- collection::const_iterator pos, end = m_modules.end ();
446
- for (pos = m_modules.begin (); pos != end; ++pos) {
447
- (*pos)->FindGlobalVariables (name, CompilerDeclContext (), max_matches,
448
- variable_list);
437
+ for (const ModuleSP &module_sp : m_modules) {
438
+ module_sp->FindGlobalVariables (name, CompilerDeclContext (), max_matches,
439
+ variable_list);
449
440
}
450
441
}
451
442
452
443
void ModuleList::FindGlobalVariables (const RegularExpression ®ex,
453
444
size_t max_matches,
454
445
VariableList &variable_list) const {
455
446
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
456
- collection::const_iterator pos, end = m_modules.end ();
457
- for (pos = m_modules.begin (); pos != end; ++pos) {
458
- (*pos)->FindGlobalVariables (regex, max_matches, variable_list);
459
- }
447
+ for (const ModuleSP &module_sp : m_modules)
448
+ module_sp->FindGlobalVariables (regex, max_matches, variable_list);
460
449
}
461
450
462
451
void ModuleList::FindSymbolsWithNameAndType (ConstString name,
463
452
SymbolType symbol_type,
464
453
SymbolContextList &sc_list) const {
465
454
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
466
- collection::const_iterator pos, end = m_modules.end ();
467
- for (pos = m_modules.begin (); pos != end; ++pos)
468
- (*pos)->FindSymbolsWithNameAndType (name, symbol_type, sc_list);
455
+ for (const ModuleSP &module_sp : m_modules)
456
+ module_sp->FindSymbolsWithNameAndType (name, symbol_type, sc_list);
469
457
}
470
458
471
459
void ModuleList::FindSymbolsMatchingRegExAndType (
472
460
const RegularExpression ®ex, lldb::SymbolType symbol_type,
473
461
SymbolContextList &sc_list) const {
474
462
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
475
- collection::const_iterator pos, end = m_modules.end ();
476
- for (pos = m_modules.begin (); pos != end; ++pos)
477
- (*pos)->FindSymbolsMatchingRegExAndType (regex, symbol_type, sc_list);
463
+ for (const ModuleSP &module_sp : m_modules)
464
+ module_sp->FindSymbolsMatchingRegExAndType (regex, symbol_type, sc_list);
478
465
}
479
466
480
467
void ModuleList::FindModules (const ModuleSpec &module_spec,
481
468
ModuleList &matching_module_list) const {
482
469
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
483
- collection::const_iterator pos, end = m_modules.end ();
484
- for (pos = m_modules.begin (); pos != end; ++pos) {
485
- ModuleSP module_sp (*pos);
470
+ for (const ModuleSP &module_sp : m_modules) {
486
471
if (module_sp->MatchesModuleSpec (module_spec))
487
472
matching_module_list.Append (module_sp);
488
473
}
@@ -558,9 +543,8 @@ void ModuleList::FindTypes(Module *search_first, ConstString name,
558
543
bool ModuleList::FindSourceFile (const FileSpec &orig_spec,
559
544
FileSpec &new_spec) const {
560
545
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
561
- collection::const_iterator pos, end = m_modules.end ();
562
- for (pos = m_modules.begin (); pos != end; ++pos) {
563
- if ((*pos)->FindSourceFile (orig_spec, new_spec))
546
+ for (const ModuleSP &module_sp : m_modules) {
547
+ if (module_sp->FindSourceFile (orig_spec, new_spec))
564
548
return true ;
565
549
}
566
550
return false ;
@@ -572,10 +556,9 @@ void ModuleList::FindAddressesForLine(const lldb::TargetSP target_sp,
572
556
std::vector<Address> &output_local,
573
557
std::vector<Address> &output_extern) {
574
558
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
575
- collection::const_iterator pos, end = m_modules.end ();
576
- for (pos = m_modules.begin (); pos != end; ++pos) {
577
- (*pos)->FindAddressesForLine (target_sp, file, line, function, output_local,
578
- output_extern);
559
+ for (const ModuleSP &module_sp : m_modules) {
560
+ module_sp->FindAddressesForLine (target_sp, file, line, function,
561
+ output_local, output_extern);
579
562
}
580
563
}
581
564
@@ -602,10 +585,8 @@ size_t ModuleList::GetSize() const {
602
585
603
586
void ModuleList::Dump (Stream *s) const {
604
587
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
605
- collection::const_iterator pos, end = m_modules.end ();
606
- for (pos = m_modules.begin (); pos != end; ++pos) {
607
- (*pos)->Dump (s);
608
- }
588
+ for (const ModuleSP &module_sp : m_modules)
589
+ module_sp->Dump (s);
609
590
}
610
591
611
592
void ModuleList::LogUUIDAndPaths (Log *log, const char *prefix_cstr) {
@@ -628,9 +609,8 @@ void ModuleList::LogUUIDAndPaths(Log *log, const char *prefix_cstr) {
628
609
bool ModuleList::ResolveFileAddress (lldb::addr_t vm_addr,
629
610
Address &so_addr) const {
630
611
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
631
- collection::const_iterator pos, end = m_modules.end ();
632
- for (pos = m_modules.begin (); pos != end; ++pos) {
633
- if ((*pos)->ResolveFileAddress (vm_addr, so_addr))
612
+ for (const ModuleSP &module_sp : m_modules) {
613
+ if (module_sp->ResolveFileAddress (vm_addr, so_addr))
634
614
return true ;
635
615
}
636
616
@@ -673,10 +653,9 @@ uint32_t ModuleList::ResolveSymbolContextsForFileSpec(
673
653
const FileSpec &file_spec, uint32_t line, bool check_inlines,
674
654
SymbolContextItem resolve_scope, SymbolContextList &sc_list) const {
675
655
std::lock_guard<std::recursive_mutex> guard (m_modules_mutex);
676
- collection::const_iterator pos, end = m_modules.end ();
677
- for (pos = m_modules.begin (); pos != end; ++pos) {
678
- (*pos)->ResolveSymbolContextsForFileSpec (file_spec, line, check_inlines,
679
- resolve_scope, sc_list);
656
+ for (const ModuleSP &module_sp : m_modules) {
657
+ module_sp->ResolveSymbolContextsForFileSpec (file_spec, line, check_inlines,
658
+ resolve_scope, sc_list);
680
659
}
681
660
682
661
return sc_list.GetSize ();
0 commit comments