Skip to content

Commit 8991ad4

Browse files
committed
[lldb] Make ModuleSpecList iterable (NFC)
1 parent 94189b4 commit 8991ad4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lldb/include/lldb/Core/ModuleSpec.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "lldb/Target/PathMappingList.h"
1414
#include "lldb/Utility/ArchSpec.h"
1515
#include "lldb/Utility/FileSpec.h"
16+
#include "lldb/Utility/Iterable.h"
1617
#include "lldb/Utility/Stream.h"
1718
#include "lldb/Utility/UUID.h"
1819

@@ -287,7 +288,7 @@ class ModuleSpecList {
287288
if (this != &rhs) {
288289
std::lock(m_mutex, rhs.m_mutex);
289290
std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex, std::adopt_lock);
290-
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
291+
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
291292
std::adopt_lock);
292293
m_specs = rhs.m_specs;
293294
}
@@ -387,8 +388,16 @@ class ModuleSpecList {
387388
}
388389
}
389390

391+
typedef std::vector<ModuleSpec> collection;
392+
typedef LockingAdaptedIterable<collection, ModuleSpec, vector_adapter,
393+
std::recursive_mutex>
394+
ModuleSpecIterable;
395+
396+
ModuleSpecIterable ModuleSpecs() {
397+
return ModuleSpecIterable(m_specs, m_mutex);
398+
}
399+
390400
protected:
391-
typedef std::vector<ModuleSpec> collection; ///< The module collection type.
392401
collection m_specs; ///< The collection of modules.
393402
mutable std::recursive_mutex m_mutex;
394403
};

0 commit comments

Comments
 (0)