Skip to content

Commit

Permalink
[lldb] Make ModuleSpecList iterable (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
JDevlieghere committed Mar 29, 2022
1 parent 94189b4 commit 8991ad4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lldb/include/lldb/Core/ModuleSpec.h
Expand Up @@ -13,6 +13,7 @@
#include "lldb/Target/PathMappingList.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/FileSpec.h"
#include "lldb/Utility/Iterable.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/UUID.h"

Expand Down Expand Up @@ -287,7 +288,7 @@ class ModuleSpecList {
if (this != &rhs) {
std::lock(m_mutex, rhs.m_mutex);
std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex, std::adopt_lock);
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
std::adopt_lock);
m_specs = rhs.m_specs;
}
Expand Down Expand Up @@ -387,8 +388,16 @@ class ModuleSpecList {
}
}

typedef std::vector<ModuleSpec> collection;
typedef LockingAdaptedIterable<collection, ModuleSpec, vector_adapter,
std::recursive_mutex>
ModuleSpecIterable;

ModuleSpecIterable ModuleSpecs() {
return ModuleSpecIterable(m_specs, m_mutex);
}

protected:
typedef std::vector<ModuleSpec> collection; ///< The module collection type.
collection m_specs; ///< The collection of modules.
mutable std::recursive_mutex m_mutex;
};
Expand Down

0 comments on commit 8991ad4

Please sign in to comment.