[Lldb-commits] [PATCH] D47492: DWARFUnit::m_die_array swap()->shrink_to_fit()

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 31 01:59:55 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL333636: Simplify DWARFUnit::m_die_array swap() to use shrink_to_fit() (authored by jankratochvil, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D47492?vs=148964&id=149250#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D47492

Files:
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp


Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -180,15 +180,7 @@
     m_first_die = m_die_array.front();
   }
 
-  // Since std::vector objects will double their size, we really need to make a
-  // new array with the perfect size so we don't end up wasting space. So here
-  // we copy and swap to make sure we don't have any extra memory taken up.
-
-  if (m_die_array.size() < m_die_array.capacity()) {
-    DWARFDebugInfoEntry::collection exact_size_die_array(m_die_array.begin(),
-                                                         m_die_array.end());
-    exact_size_die_array.swap(m_die_array);
-  }
+  m_die_array.shrink_to_fit();
 
   ExtractDIEsEndCheck(offset);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47492.149250.patch
Type: text/x-patch
Size: 891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180531/76c0f8b6/attachment.bin>


More information about the lldb-commits mailing list