[lldb][Module][NFC] Add ModuleList::AnyOf

Differential Revision: https://reviews.llvm.org/D139083
This commit is contained in:
Michael Buch
2022-12-01 09:24:32 +00:00
parent 83599000e1
commit 5941858efd
2 changed files with 20 additions and 0 deletions

View File

@@ -1074,3 +1074,16 @@ void ModuleList::ForEach(
break;
}
}
bool ModuleList::AnyOf(
std::function<bool(lldb_private::Module &module_sp)> const &callback)
const {
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
for (const auto &module_sp : m_modules) {
assert(module_sp != nullptr);
if (callback(*module_sp))
return true;
}
return false;
}