}
}
-bool ModuleList::AppendIfNeeded(const ModuleSP &module_sp, bool notify) {
- if (module_sp) {
+bool ModuleList::AppendIfNeeded(const ModuleSP &new_module, bool notify) {
+ if (new_module) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- if (pos->get() == module_sp.get())
+ for (const ModuleSP &module_sp : m_modules) {
+ if (module_sp.get() == new_module.get())
return false; // Already in the list
}
// Only push module_sp on the list if it wasn't already in there.
- Append(module_sp, notify);
+ Append(new_module, notify);
return true;
}
return false;
Module::LookupInfo lookup_info(name, name_type_mask, eLanguageTypeUnknown);
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindFunctions(lookup_info.GetLookupName(), CompilerDeclContext(),
- lookup_info.GetNameTypeMask(), options, sc_list);
+ for (const ModuleSP &module_sp : m_modules) {
+ module_sp->FindFunctions(lookup_info.GetLookupName(),
+ CompilerDeclContext(),
+ lookup_info.GetNameTypeMask(), options, sc_list);
}
const size_t new_size = sc_list.GetSize();
lookup_info.Prune(sc_list, old_size);
} else {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindFunctions(name, CompilerDeclContext(), name_type_mask,
- options, sc_list);
+ for (const ModuleSP &module_sp : m_modules) {
+ module_sp->FindFunctions(name, CompilerDeclContext(), name_type_mask,
+ options, sc_list);
}
}
}
Module::LookupInfo lookup_info(name, name_type_mask, eLanguageTypeUnknown);
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindFunctionSymbols(lookup_info.GetLookupName(),
- lookup_info.GetNameTypeMask(), sc_list);
+ for (const ModuleSP &module_sp : m_modules) {
+ module_sp->FindFunctionSymbols(lookup_info.GetLookupName(),
+ lookup_info.GetNameTypeMask(), sc_list);
}
const size_t new_size = sc_list.GetSize();
lookup_info.Prune(sc_list, old_size);
} else {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindFunctionSymbols(name, name_type_mask, sc_list);
+ for (const ModuleSP &module_sp : m_modules) {
+ module_sp->FindFunctionSymbols(name, name_type_mask, sc_list);
}
}
}
const ModuleFunctionSearchOptions &options,
SymbolContextList &sc_list) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindFunctions(name, options, sc_list);
- }
+ for (const ModuleSP &module_sp : m_modules)
+ module_sp->FindFunctions(name, options, sc_list);
}
void ModuleList::FindCompileUnits(const FileSpec &path,
SymbolContextList &sc_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindCompileUnits(path, sc_list);
- }
+ for (const ModuleSP &module_sp : m_modules)
+ module_sp->FindCompileUnits(path, sc_list);
}
void ModuleList::FindGlobalVariables(ConstString name, size_t max_matches,
VariableList &variable_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindGlobalVariables(name, CompilerDeclContext(), max_matches,
- variable_list);
+ for (const ModuleSP &module_sp : m_modules) {
+ module_sp->FindGlobalVariables(name, CompilerDeclContext(), max_matches,
+ variable_list);
}
}
size_t max_matches,
VariableList &variable_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindGlobalVariables(regex, max_matches, variable_list);
- }
+ for (const ModuleSP &module_sp : m_modules)
+ module_sp->FindGlobalVariables(regex, max_matches, variable_list);
}
void ModuleList::FindSymbolsWithNameAndType(ConstString name,
SymbolType symbol_type,
SymbolContextList &sc_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos)
- (*pos)->FindSymbolsWithNameAndType(name, symbol_type, sc_list);
+ for (const ModuleSP &module_sp : m_modules)
+ module_sp->FindSymbolsWithNameAndType(name, symbol_type, sc_list);
}
void ModuleList::FindSymbolsMatchingRegExAndType(
const RegularExpression ®ex, lldb::SymbolType symbol_type,
SymbolContextList &sc_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos)
- (*pos)->FindSymbolsMatchingRegExAndType(regex, symbol_type, sc_list);
+ for (const ModuleSP &module_sp : m_modules)
+ module_sp->FindSymbolsMatchingRegExAndType(regex, symbol_type, sc_list);
}
void ModuleList::FindModules(const ModuleSpec &module_spec,
ModuleList &matching_module_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- ModuleSP module_sp(*pos);
+ for (const ModuleSP &module_sp : m_modules) {
if (module_sp->MatchesModuleSpec(module_spec))
matching_module_list.Append(module_sp);
}
bool ModuleList::FindSourceFile(const FileSpec &orig_spec,
FileSpec &new_spec) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- if ((*pos)->FindSourceFile(orig_spec, new_spec))
+ for (const ModuleSP &module_sp : m_modules) {
+ if (module_sp->FindSourceFile(orig_spec, new_spec))
return true;
}
return false;
std::vector<Address> &output_local,
std::vector<Address> &output_extern) {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->FindAddressesForLine(target_sp, file, line, function, output_local,
- output_extern);
+ for (const ModuleSP &module_sp : m_modules) {
+ module_sp->FindAddressesForLine(target_sp, file, line, function,
+ output_local, output_extern);
}
}
void ModuleList::Dump(Stream *s) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->Dump(s);
- }
+ for (const ModuleSP &module_sp : m_modules)
+ module_sp->Dump(s);
}
void ModuleList::LogUUIDAndPaths(Log *log, const char *prefix_cstr) {
bool ModuleList::ResolveFileAddress(lldb::addr_t vm_addr,
Address &so_addr) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- if ((*pos)->ResolveFileAddress(vm_addr, so_addr))
+ for (const ModuleSP &module_sp : m_modules) {
+ if (module_sp->ResolveFileAddress(vm_addr, so_addr))
return true;
}
const FileSpec &file_spec, uint32_t line, bool check_inlines,
SymbolContextItem resolve_scope, SymbolContextList &sc_list) const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
- collection::const_iterator pos, end = m_modules.end();
- for (pos = m_modules.begin(); pos != end; ++pos) {
- (*pos)->ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
- resolve_scope, sc_list);
+ for (const ModuleSP &module_sp : m_modules) {
+ module_sp->ResolveSymbolContextsForFileSpec(file_spec, line, check_inlines,
+ resolve_scope, sc_list);
}
return sc_list.GetSize();