[Lldb-commits] [PATCH] D65089: SymbolVendor: Move compile unit handling into the SymbolFile class

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 22 07:10:03 PDT 2019


clayborg added a comment.

Looks good. Just one question about caching the calculated number of compile units.



================
Comment at: source/Symbol/SymbolFile.cpp:174-182
+uint32_t SymbolFile::GetNumCompileUnits() {
+  std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
+  if (m_compile_units.empty()) {
+    // Resize our array of compile unit shared pointers -- which will each
+    // remain NULL until someone asks for the actual compile unit information.
+    m_compile_units.resize(CalculateNumCompileUnits());
+  }
----------------
For symbol files without compile units we will end up calling into CalculateNumCompileUnits() many tines. Can we set a bool to indicate we have already calculated the number of compile units to avoid this? 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65089/new/

https://reviews.llvm.org/D65089





More information about the lldb-commits mailing list