Skip to content

Commit 49453bf

Browse files
authored
[lldb][NFC] remove AdaptedConstIterator and AdaptedIterable (#127507)
AdaptedConstIterator currently doesn't have iterator traits, so I can't use STL algorithms with containers like WatchpointList. This patch replaces AdaptedConstIterator and AdaptedIterable with llvm::iterator_adaped_base and llvm::iterator_range respectively.
1 parent 360630b commit 49453bf

15 files changed

+38
-188
lines changed

lldb/include/lldb/Breakpoint/BreakpointList.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ class BreakpointList {
163163
bool m_is_internal;
164164

165165
public:
166-
typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP,
167-
list_adapter, std::recursive_mutex>
166+
typedef LockingAdaptedIterable<std::recursive_mutex, bp_collection>
168167
BreakpointIterable;
169168
BreakpointIterable Breakpoints() {
170169
return BreakpointIterable(m_breakpoints, GetMutex());

lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ class BreakpointLocationCollection {
165165
mutable std::mutex m_collection_mutex;
166166

167167
public:
168-
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP,
169-
vector_adapter>
168+
typedef llvm::iterator_range<collection::const_iterator>
170169
BreakpointLocationCollectionIterable;
171170
BreakpointLocationCollectionIterable BreakpointLocations() {
172171
return BreakpointLocationCollectionIterable(m_break_loc_collection);

lldb/include/lldb/Breakpoint/BreakpointLocationList.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ class BreakpointLocationList {
204204
BreakpointLocationCollection *m_new_location_recorder;
205205

206206
public:
207-
typedef AdaptedIterable<collection, lldb::BreakpointLocationSP,
208-
vector_adapter>
207+
typedef llvm::iterator_range<collection::const_iterator>
209208
BreakpointLocationIterable;
210209

211210
BreakpointLocationIterable BreakpointLocations() {

lldb/include/lldb/Breakpoint/WatchpointList.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class WatchpointList {
3939
~WatchpointList();
4040

4141
typedef std::list<lldb::WatchpointSP> wp_collection;
42-
typedef LockingAdaptedIterable<wp_collection, lldb::WatchpointSP,
43-
vector_adapter, std::recursive_mutex>
42+
typedef LockingAdaptedIterable<std::recursive_mutex, wp_collection>
4443
WatchpointIterable;
4544

4645
/// Add a Watchpoint to the list.

lldb/include/lldb/Breakpoint/WatchpointResource.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class WatchpointResource
3939
void SetType(bool read, bool write);
4040

4141
typedef std::vector<lldb::WatchpointSP> WatchpointCollection;
42-
typedef LockingAdaptedIterable<WatchpointCollection, lldb::WatchpointSP,
43-
vector_adapter, std::mutex>
42+
typedef LockingAdaptedIterable<std::mutex, WatchpointCollection>
4443
WatchpointIterable;
4544

4645
/// Iterate over the watchpoint constituents for this resource

lldb/include/lldb/Core/ModuleList.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,13 @@ class ModuleList {
521521
Notifier *m_notifier = nullptr;
522522

523523
public:
524-
typedef LockingAdaptedIterable<collection, lldb::ModuleSP, vector_adapter,
525-
std::recursive_mutex>
524+
typedef LockingAdaptedIterable<std::recursive_mutex, collection>
526525
ModuleIterable;
527526
ModuleIterable Modules() const {
528527
return ModuleIterable(m_modules, GetMutex());
529528
}
530529

531-
typedef AdaptedIterable<collection, lldb::ModuleSP, vector_adapter>
530+
typedef llvm::iterator_range<collection::const_iterator>
532531
ModuleIterableNoLocking;
533532
ModuleIterableNoLocking ModulesNoLocking() const {
534533
return ModuleIterableNoLocking(m_modules);

lldb/include/lldb/Core/ModuleSpec.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,7 @@ class ModuleSpecList {
389389
}
390390

391391
typedef std::vector<ModuleSpec> collection;
392-
typedef LockingAdaptedIterable<collection, ModuleSpec, vector_adapter,
393-
std::recursive_mutex>
392+
typedef LockingAdaptedIterable<std::recursive_mutex, collection>
394393
ModuleSpecIterable;
395394

396395
ModuleSpecIterable ModuleSpecs() {

lldb/include/lldb/Host/common/NativeProcessProtocol.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,9 @@ class NativeProcessProtocol {
5151
virtual ~NativeProcessProtocol() = default;
5252

5353
typedef std::vector<std::unique_ptr<NativeThreadProtocol>> thread_collection;
54-
template <typename I>
55-
static NativeThreadProtocol &thread_list_adapter(I &iter) {
56-
assert(*iter);
57-
return **iter;
58-
}
59-
typedef LockingAdaptedIterable<thread_collection, NativeThreadProtocol &,
60-
thread_list_adapter, std::recursive_mutex>
54+
typedef LockingAdaptedIterable<
55+
std::recursive_mutex, thread_collection,
56+
llvm::pointee_iterator<thread_collection::const_iterator>>
6157
ThreadIterable;
6258

6359
virtual Status Resume(const ResumeActionList &resume_actions) = 0;

lldb/include/lldb/Symbol/SymbolContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ class SymbolContextList {
467467
const_iterator begin() const { return m_symbol_contexts.begin(); }
468468
const_iterator end() const { return m_symbol_contexts.end(); }
469469

470-
typedef AdaptedIterable<collection, SymbolContext, vector_adapter>
470+
typedef llvm::iterator_range<collection::const_iterator>
471471
SymbolContextIterable;
472472
SymbolContextIterable SymbolContexts() {
473473
return SymbolContextIterable(m_symbol_contexts);

lldb/include/lldb/Symbol/TypeList.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ class TypeList {
3939
lldb::TypeSP GetTypeAtIndex(uint32_t idx);
4040

4141
typedef std::vector<lldb::TypeSP> collection;
42-
typedef AdaptedIterable<collection, lldb::TypeSP, vector_adapter>
43-
TypeIterable;
42+
typedef llvm::iterator_range<collection::const_iterator> TypeIterable;
4443

4544
TypeIterable Types() { return TypeIterable(m_types); }
4645

0 commit comments

Comments
 (0)