[lldb] Use llvm::find_if (NFC) (#141385)
This commit is contained in:
parent
c4cfc95d76
commit
ef29a79adf
@ -278,9 +278,8 @@ protected:
|
||||
[site_id](const std::pair<lldb::addr_t, StopPointSiteSP> s) {
|
||||
return site_id == s.second->GetID();
|
||||
};
|
||||
return std::find_if(m_site_list.begin(),
|
||||
m_site_list.end(), // Search full range
|
||||
id_matches);
|
||||
return llvm::find_if(m_site_list, // Search full range
|
||||
id_matches);
|
||||
}
|
||||
|
||||
typename collection::const_iterator
|
||||
@ -290,9 +289,8 @@ protected:
|
||||
[site_id](const std::pair<lldb::addr_t, StopPointSiteSP> s) {
|
||||
return site_id == s.second->GetID();
|
||||
};
|
||||
return std::find_if(m_site_list.begin(),
|
||||
m_site_list.end(), // Search full range
|
||||
id_matches);
|
||||
return llvm::find_if(m_site_list, // Search full range
|
||||
id_matches);
|
||||
}
|
||||
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
|
||||
@ -47,9 +47,9 @@ break_id_t BreakpointList::Add(BreakpointSP &bp_sp, bool notify) {
|
||||
bool BreakpointList::Remove(break_id_t break_id, bool notify) {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||
|
||||
auto it = std::find_if(
|
||||
m_breakpoints.begin(), m_breakpoints.end(),
|
||||
[&](const BreakpointSP &bp) { return bp->GetID() == break_id; });
|
||||
auto it = llvm::find_if(m_breakpoints, [&](const BreakpointSP &bp) {
|
||||
return bp->GetID() == break_id;
|
||||
});
|
||||
|
||||
if (it == m_breakpoints.end())
|
||||
return false;
|
||||
@ -109,16 +109,16 @@ void BreakpointList::RemoveAllowed(bool notify) {
|
||||
|
||||
BreakpointList::bp_collection::iterator
|
||||
BreakpointList::GetBreakpointIDIterator(break_id_t break_id) {
|
||||
return std::find_if(
|
||||
m_breakpoints.begin(), m_breakpoints.end(),
|
||||
[&](const BreakpointSP &bp) { return bp->GetID() == break_id; });
|
||||
return llvm::find_if(m_breakpoints, [&](const BreakpointSP &bp) {
|
||||
return bp->GetID() == break_id;
|
||||
});
|
||||
}
|
||||
|
||||
BreakpointList::bp_collection::const_iterator
|
||||
BreakpointList::GetBreakpointIDConstIterator(break_id_t break_id) const {
|
||||
return std::find_if(
|
||||
m_breakpoints.begin(), m_breakpoints.end(),
|
||||
[&](const BreakpointSP &bp) { return bp->GetID() == break_id; });
|
||||
return llvm::find_if(m_breakpoints, [&](const BreakpointSP &bp) {
|
||||
return bp->GetID() == break_id;
|
||||
});
|
||||
}
|
||||
|
||||
BreakpointSP BreakpointList::FindBreakpointByID(break_id_t break_id) const {
|
||||
|
||||
@ -60,18 +60,16 @@ private:
|
||||
BreakpointLocationCollection::collection::iterator
|
||||
BreakpointLocationCollection::GetIDPairIterator(lldb::break_id_t break_id,
|
||||
lldb::break_id_t break_loc_id) {
|
||||
return std::find_if(
|
||||
m_break_loc_collection.begin(),
|
||||
m_break_loc_collection.end(), // Search full range
|
||||
return llvm::find_if(
|
||||
m_break_loc_collection, // Search full range
|
||||
BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
|
||||
}
|
||||
|
||||
BreakpointLocationCollection::collection::const_iterator
|
||||
BreakpointLocationCollection::GetIDPairConstIterator(
|
||||
lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const {
|
||||
return std::find_if(
|
||||
m_break_loc_collection.begin(),
|
||||
m_break_loc_collection.end(), // Search full range
|
||||
return llvm::find_if(
|
||||
m_break_loc_collection, // Search full range
|
||||
BreakpointIDPairMatches(break_id, break_loc_id)); // Predicate
|
||||
}
|
||||
|
||||
|
||||
@ -98,16 +98,14 @@ private:
|
||||
|
||||
WatchpointList::wp_collection::iterator
|
||||
WatchpointList::GetIDIterator(lldb::watch_id_t watch_id) {
|
||||
return std::find_if(m_watchpoints.begin(),
|
||||
m_watchpoints.end(), // Search full range
|
||||
WatchpointIDMatches(watch_id)); // Predicate
|
||||
return llvm::find_if(m_watchpoints, // Search full range
|
||||
WatchpointIDMatches(watch_id)); // Predicate
|
||||
}
|
||||
|
||||
WatchpointList::wp_collection::const_iterator
|
||||
WatchpointList::GetIDConstIterator(lldb::watch_id_t watch_id) const {
|
||||
return std::find_if(m_watchpoints.begin(),
|
||||
m_watchpoints.end(), // Search full range
|
||||
WatchpointIDMatches(watch_id)); // Predicate
|
||||
return llvm::find_if(m_watchpoints, // Search full range
|
||||
WatchpointIDMatches(watch_id)); // Predicate
|
||||
}
|
||||
|
||||
WatchpointSP WatchpointList::FindByID(lldb::watch_id_t watch_id) const {
|
||||
|
||||
@ -2225,9 +2225,9 @@ void Debugger::HandleProgressEvent(const lldb::EventSP &event_sp) {
|
||||
// progress reports.
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(m_progress_reports_mutex);
|
||||
auto it = std::find_if(
|
||||
m_progress_reports.begin(), m_progress_reports.end(),
|
||||
[&](const auto &report) { return report.id == progress_report.id; });
|
||||
auto it = llvm::find_if(m_progress_reports, [&](const auto &report) {
|
||||
return report.id == progress_report.id;
|
||||
});
|
||||
if (it != m_progress_reports.end()) {
|
||||
const bool complete = data->GetCompleted() == data->GetTotal();
|
||||
if (complete)
|
||||
|
||||
@ -315,9 +315,9 @@ public:
|
||||
}
|
||||
|
||||
bool SetInstanceEnabled(llvm::StringRef name, bool enable) {
|
||||
auto it = std::find_if(
|
||||
m_instances.begin(), m_instances.end(),
|
||||
[&](const Instance &instance) { return instance.name == name; });
|
||||
auto it = llvm::find_if(m_instances, [&](const Instance &instance) {
|
||||
return instance.name == name;
|
||||
});
|
||||
|
||||
if (it == m_instances.end())
|
||||
return false;
|
||||
|
||||
@ -112,9 +112,10 @@ void TypeCategoryMap::EnableAllCategories() {
|
||||
continue;
|
||||
auto pos = iter->second->GetLastEnabledPosition();
|
||||
if (pos >= sorted_categories.size()) {
|
||||
auto iter = std::find_if(
|
||||
sorted_categories.begin(), sorted_categories.end(),
|
||||
[](const TypeCategoryImplSP &sp) -> bool { return sp.get() == nullptr; });
|
||||
auto iter = llvm::find_if(sorted_categories,
|
||||
[](const TypeCategoryImplSP &sp) -> bool {
|
||||
return sp.get() == nullptr;
|
||||
});
|
||||
pos = std::distance(sorted_categories.begin(), iter);
|
||||
}
|
||||
sorted_categories.at(pos) = iter->second;
|
||||
|
||||
@ -382,8 +382,8 @@ bool TargetList::DeleteTarget(TargetSP &target_sp) {
|
||||
TargetSP TargetList::FindTargetWithExecutableAndArchitecture(
|
||||
const FileSpec &exe_file_spec, const ArchSpec *exe_arch_ptr) const {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
|
||||
auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
|
||||
[&exe_file_spec, exe_arch_ptr](const TargetSP &item) {
|
||||
auto it = llvm::find_if(
|
||||
m_target_list, [&exe_file_spec, exe_arch_ptr](const TargetSP &item) {
|
||||
Module *exe_module = item->GetExecutableModulePointer();
|
||||
if (!exe_module ||
|
||||
!FileSpec::Match(exe_file_spec, exe_module->GetFileSpec()))
|
||||
@ -401,11 +401,10 @@ TargetSP TargetList::FindTargetWithExecutableAndArchitecture(
|
||||
|
||||
TargetSP TargetList::FindTargetWithProcessID(lldb::pid_t pid) const {
|
||||
std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
|
||||
auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
|
||||
[pid](const TargetSP &item) {
|
||||
auto *process_ptr = item->GetProcessSP().get();
|
||||
return process_ptr && (process_ptr->GetID() == pid);
|
||||
});
|
||||
auto it = llvm::find_if(m_target_list, [pid](const TargetSP &item) {
|
||||
auto *process_ptr = item->GetProcessSP().get();
|
||||
return process_ptr && (process_ptr->GetID() == pid);
|
||||
});
|
||||
|
||||
if (it != m_target_list.end())
|
||||
return *it;
|
||||
@ -419,10 +418,9 @@ TargetSP TargetList::FindTargetWithProcess(Process *process) const {
|
||||
return target_sp;
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
|
||||
auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
|
||||
[process](const TargetSP &item) {
|
||||
return item->GetProcessSP().get() == process;
|
||||
});
|
||||
auto it = llvm::find_if(m_target_list, [process](const TargetSP &item) {
|
||||
return item->GetProcessSP().get() == process;
|
||||
});
|
||||
|
||||
if (it != m_target_list.end())
|
||||
target_sp = *it;
|
||||
@ -436,8 +434,9 @@ TargetSP TargetList::GetTargetSP(Target *target) const {
|
||||
return target_sp;
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_target_list_mutex);
|
||||
auto it = std::find_if(m_target_list.begin(), m_target_list.end(),
|
||||
[target](const TargetSP &item) { return item.get() == target; });
|
||||
auto it = llvm::find_if(m_target_list, [target](const TargetSP &item) {
|
||||
return item.get() == target;
|
||||
});
|
||||
if (it != m_target_list.end())
|
||||
target_sp = *it;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user