[Lldb-commits] [lldb] r177773 - Add a Reserve method to RangeVector and RangeDataVector. Have the

Jason Molenda jmolenda at apple.com
Fri Mar 22 15:43:14 PDT 2013


Author: jmolenda
Date: Fri Mar 22 17:43:14 2013
New Revision: 177773

URL: http://llvm.org/viewvc/llvm-project?rev=177773&view=rev
Log:
Add a Reserve method to RangeVector and RangeDataVector.  Have the
DWARFCallFrameInfo method which returns a RangeVector pre-size the
vector based on the number of entries it will be adding insted of
growing the vector as items are added.


Modified:
    lldb/trunk/include/lldb/Core/RangeMap.h
    lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp

Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=177773&r1=177772&r2=177773&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Fri Mar 22 17:43:14 2013
@@ -588,7 +588,13 @@ namespace lldb_private {
         {
             m_entries.clear();
         }
-        
+
+        void
+        Reserve (typename Collection::size_type size)
+        {
+            m_entries.resize (size);
+        }
+
         bool
         IsEmpty () const
         {
@@ -1137,7 +1143,13 @@ namespace lldb_private {
         {
             m_entries.clear();
         }
-        
+
+        void
+        Reserve (typename Collection::size_type size)
+        {
+            m_entries.resize (size);
+        }
+
         bool
         IsEmpty () const
         {

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=177773&r1=177772&r2=177773&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Fri Mar 22 17:43:14 2013
@@ -109,6 +109,8 @@ DWARFCallFrameInfo::GetFunctionAddressAn
 {
     GetFDEIndex();
     const size_t count = m_fde_index.GetSize();
+    function_info.Clear();
+    function_info.Reserve(count);
     for (size_t i = 0; i < count; ++i)
     {
         const FDEEntryMap::Entry *func_offset_data_entry = m_fde_index.GetEntryAtIndex (i);





More information about the lldb-commits mailing list