Skip to content

Commit d3f4680

Browse files
author
git apple-llvm automerger
committed
Merge commit '83599000e1f4' from llvm.org/main into next
2 parents 30e887b + 8359900 commit d3f4680

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lldb/include/lldb/Core/ModuleList.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,12 @@ class ModuleList {
481481

482482
static bool RemoveSharedModuleIfOrphaned(const Module *module_ptr);
483483

484+
/// Applies 'callback' to each module in this ModuleList.
485+
/// If 'callback' returns false, iteration terminates.
486+
/// The 'module_sp' passed to 'callback' is guaranteed to
487+
/// be non-null.
488+
///
489+
/// This function is thread-safe.
484490
void ForEach(std::function<bool(const lldb::ModuleSP &module_sp)> const
485491
&callback) const;
486492

lldb/source/Core/ModuleList.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,9 +1266,10 @@ bool ModuleList::LoadScriptingResourcesInTarget(Target *target,
12661266
void ModuleList::ForEach(
12671267
std::function<bool(const ModuleSP &module_sp)> const &callback) const {
12681268
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
1269-
for (const auto &module : m_modules) {
1269+
for (const auto &module_sp : m_modules) {
1270+
assert(module_sp != nullptr);
12701271
// If the callback returns false, then stop iterating and break out
1271-
if (!callback(module))
1272+
if (!callback(module_sp))
12721273
break;
12731274
}
12741275
}

0 commit comments

Comments
 (0)