Skip to content

Commit cf20f46

Browse files
committed
[lldb] Make ModuleSpecList iterable (NFC)
(cherry picked from commit 8991ad4)
1 parent 850bc40 commit cf20f46

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

@@ -293,7 +294,7 @@ class ModuleSpecList {
293294
if (this != &rhs) {
294295
std::lock(m_mutex, rhs.m_mutex);
295296
std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex, std::adopt_lock);
296-
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
297+
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
297298
std::adopt_lock);
298299
m_specs = rhs.m_specs;
299300
}
@@ -393,8 +394,16 @@ class ModuleSpecList {
393394
}
394395
}
395396

397+
typedef std::vector<ModuleSpec> collection;
398+
typedef LockingAdaptedIterable<collection, ModuleSpec, vector_adapter,
399+
std::recursive_mutex>
400+
ModuleSpecIterable;
401+
402+
ModuleSpecIterable ModuleSpecs() {
403+
return ModuleSpecIterable(m_specs, m_mutex);
404+
}
405+
396406
protected:
397-
typedef std::vector<ModuleSpec> collection; ///< The module collection type.
398407
collection m_specs; ///< The collection of modules.
399408
mutable std::recursive_mutex m_mutex;
400409
};

0 commit comments

Comments
 (0)