[Lldb-commits] [lldb] r160448 - in /lldb/trunk: include/lldb/Symbol/UnwindPlan.h source/Symbol/UnwindPlan.cpp

Greg Clayton gclayton at apple.com
Wed Jul 18 13:37:53 PDT 2012


Author: gclayton
Date: Wed Jul 18 15:37:53 2012
New Revision: 160448

URL: http://llvm.org/viewvc/llvm-project?rev=160448&view=rev
Log:
Cleaned up incorrect STL std::map comparison code and use the operator == on std::map objects instead of manually implementing the comparisons. Also modified the UnwindPlan::AppendRow() function to take a "const RowSP &" object so we don't have to copy shared pointers when calling this function.


Modified:
    lldb/trunk/include/lldb/Symbol/UnwindPlan.h
    lldb/trunk/source/Symbol/UnwindPlan.cpp

Modified: lldb/trunk/include/lldb/Symbol/UnwindPlan.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/UnwindPlan.h?rev=160448&r1=160447&r2=160448&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/UnwindPlan.h (original)
+++ lldb/trunk/include/lldb/Symbol/UnwindPlan.h Wed Jul 18 15:37:53 2012
@@ -241,12 +241,11 @@
         Row ();
     
         Row (const UnwindPlan::Row& rhs) : 
-            m_offset(rhs.m_offset), m_cfa_reg_num(rhs.m_cfa_reg_num), m_cfa_offset(rhs.m_cfa_offset)
+            m_offset             (rhs.m_offset),
+            m_cfa_reg_num        (rhs.m_cfa_reg_num),
+            m_cfa_offset         (rhs.m_cfa_offset),
+            m_register_locations (rhs.m_register_locations)
         {
-            for (collection::const_iterator idx = rhs.m_register_locations.begin(); idx != rhs.m_register_locations.end(); ++idx)
-            {
-                m_register_locations[idx->first] = idx->second;
-            }
         }
 
         bool
@@ -326,13 +325,6 @@
         {
             m_cfa_offset = offset;
         }
-    
-        // Return the number of registers we have locations for
-        int
-        GetRegisterCount () const
-        {
-            return m_register_locations.size();
-        }
 
         void
         Clear ();
@@ -368,7 +360,7 @@
     Dump (Stream& s, Thread* thread, lldb::addr_t base_addr) const;
 
     void 
-    AppendRow (RowSP row);
+    AppendRow (const RowSP& row_sp);
 
     // Returns a pointer to the best row for the given offset into the function's instructions.
     // If offset is -1 it indicates that the function start is unknown - the final row in the UnwindPlan is returned.

Modified: lldb/trunk/source/Symbol/UnwindPlan.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/UnwindPlan.cpp?rev=160448&r1=160447&r2=160448&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/UnwindPlan.cpp (original)
+++ lldb/trunk/source/Symbol/UnwindPlan.cpp Wed Jul 18 15:37:53 2012
@@ -300,25 +300,16 @@
 {
     if (m_offset != rhs.m_offset || m_cfa_reg_num != rhs.m_cfa_reg_num || m_cfa_offset != rhs.m_cfa_offset)
         return false;
-    if (m_register_locations.size() != rhs.m_register_locations.size())
-        return false;
-    for (collection::const_iterator idx = m_register_locations.begin(); idx != m_register_locations.end(); ++idx)
-    {
-        collection::const_iterator lhs_pos = m_register_locations.find(idx->first);
-        collection::const_iterator rhs_pos = rhs.m_register_locations.find(idx->first);
-        if (lhs_pos->second != rhs_pos->second)
-            return false;
-    }
-    return true;
+    return m_register_locations == rhs.m_register_locations;
 }
 
 void
-UnwindPlan::AppendRow (UnwindPlan::RowSP row)
+UnwindPlan::AppendRow (const UnwindPlan::RowSP &row_sp)
 {
-    if (m_row_list.empty() || m_row_list.back()->GetOffset() != row->GetOffset())
-        m_row_list.push_back(row);
+    if (m_row_list.empty() || m_row_list.back()->GetOffset() != row_sp->GetOffset())
+        m_row_list.push_back(row_sp);
     else
-        m_row_list.back() = row;
+        m_row_list.back() = row_sp;
 }
 
 UnwindPlan::RowSP





More information about the lldb-commits mailing list