[Lldb-commits] [lldb] 8991ad4 - [lldb] Make ModuleSpecList iterable (NFC)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 29 15:26:59 PDT 2022
Author: Jonas Devlieghere
Date: 2022-03-29T15:26:54-07:00
New Revision: 8991ad43ffc56420dda6c797811b2bababe842da
URL: https://github.com/llvm/llvm-project/commit/8991ad43ffc56420dda6c797811b2bababe842da
DIFF: https://github.com/llvm/llvm-project/commit/8991ad43ffc56420dda6c797811b2bababe842da.diff
LOG: [lldb] Make ModuleSpecList iterable (NFC)
Added:
Modified:
lldb/include/lldb/Core/ModuleSpec.h
Removed:
################################################################################
diff --git a/lldb/include/lldb/Core/ModuleSpec.h b/lldb/include/lldb/Core/ModuleSpec.h
index bcf4ec30a673c..5789e6c8309f6 100644
--- a/lldb/include/lldb/Core/ModuleSpec.h
+++ b/lldb/include/lldb/Core/ModuleSpec.h
@@ -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"
@@ -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;
}
@@ -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;
};
More information about the lldb-commits
mailing list