[Lldb-commits] [PATCH] D139083: [lldb][Module][NFC] Add ModuleList::AnyOf
Michael Buch via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Dec 2 02:53:19 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5941858efdca: [lldb][Module][NFC] Add ModuleList::AnyOf (authored by Michael137).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139083/new/
https://reviews.llvm.org/D139083
Files:
lldb/include/lldb/Core/ModuleList.h
lldb/source/Core/ModuleList.cpp
Index: lldb/source/Core/ModuleList.cpp
===================================================================
--- lldb/source/Core/ModuleList.cpp
+++ lldb/source/Core/ModuleList.cpp
@@ -1074,3 +1074,16 @@
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;
+}
Index: lldb/include/lldb/Core/ModuleList.h
===================================================================
--- lldb/include/lldb/Core/ModuleList.h
+++ lldb/include/lldb/Core/ModuleList.h
@@ -473,6 +473,13 @@
void ForEach(std::function<bool(const lldb::ModuleSP &module_sp)> const
&callback) const;
+ /// Returns true if 'callback' returns true for one of the modules
+ /// in this ModuleList.
+ ///
+ /// This function is thread-safe.
+ bool AnyOf(
+ std::function<bool(lldb_private::Module &module)> const &callback) const;
+
protected:
// Class typedefs.
typedef std::vector<lldb::ModuleSP>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139083.479572.patch
Type: text/x-patch
Size: 1201 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221202/e604dc37/attachment.bin>
More information about the lldb-commits
mailing list