[Lldb-commits] [lldb] r223544 - Add a list iterable helper and use it to make a Breakpoint

Jim Ingham jingham at apple.com
Fri Dec 5 15:21:30 PST 2014


Author: jingham
Date: Fri Dec  5 17:21:30 2014
New Revision: 223544

URL: http://llvm.org/viewvc/llvm-project?rev=223544&view=rev
Log:
Add a list iterable helper and use it to make a Breakpoint
iterator in the BreakpointList class.

Modified:
    lldb/trunk/include/lldb/Breakpoint/BreakpointList.h
    lldb/trunk/include/lldb/Utility/Iterable.h

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointList.h?rev=223544&r1=223543&r2=223544&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointList.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointList.h Fri Dec  5 17:21:30 2014
@@ -204,11 +204,25 @@ protected:
     bp_collection::const_iterator
     GetBreakpointIDConstIterator(lldb::break_id_t breakID) const;
 
+    Mutex &
+    GetMutex () const
+    {
+        return m_mutex;
+    }
+
     mutable Mutex m_mutex;
     bp_collection m_breakpoints;  // The breakpoint list, currently a list.
     lldb::break_id_t m_next_break_id;
     bool m_is_internal;
 
+public:
+    typedef LockingAdaptedIterable<bp_collection, lldb::BreakpointSP, list_adapter> BreakpointIterable;
+    BreakpointIterable
+    Breakpoints()
+    {
+        return BreakpointIterable(m_breakpoints, GetMutex());
+    }
+
 private:
     DISALLOW_COPY_AND_ASSIGN (BreakpointList);
 };

Modified: lldb/trunk/include/lldb/Utility/Iterable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Iterable.h?rev=223544&r1=223543&r2=223544&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Iterable.h (original)
+++ lldb/trunk/include/lldb/Utility/Iterable.h Fri Dec  5 17:21:30 2014
@@ -25,6 +25,11 @@ template <typename I, typename E> E vect
     return *iter;
 }
     
+template <typename I, typename E> E list_adapter(I &iter)
+{
+    return *iter;
+}
+    
 template <typename C, typename E, E (*A)(typename C::const_iterator &)> class AdaptedConstIterator
 {
 public:





More information about the lldb-commits mailing list