[Lldb-commits] [lldb] r334012 - DWARFIndex: more GetFunctions cleanup

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 5 05:13:22 PDT 2018


Author: labath
Date: Tue Jun  5 05:13:22 2018
New Revision: 334012

URL: http://llvm.org/viewvc/llvm-project?rev=334012&view=rev
Log:
DWARFIndex: more GetFunctions cleanup

This applies similar simplification as r334004, only it touches the
regex version of the method.

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp?rev=334012&r1=334011&r2=334012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp Tue Jun  5 05:13:22 2018
@@ -217,21 +217,14 @@ void AppleDWARFIndex::GetFunctions(Const
   }
 }
 
-void AppleDWARFIndex::GetFunctions(
-    const RegularExpression &regex, DWARFDebugInfo &info,
-    llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
-                            lldb_private::SymbolContextList &sc_list)>
-        resolve_function,
-    bool include_inlines, SymbolContextList &sc_list) {
+void AppleDWARFIndex::GetFunctions(const RegularExpression &regex,
+                                   DIEArray &offsets) {
   if (!m_apple_names_up)
     return;
 
-  DIEArray offsets;
   DWARFMappedHash::DIEInfoArray hash_data;
-  if (m_apple_names_up->AppendAllDIEsThatMatchingRegex(regex, hash_data)) {
+  if (m_apple_names_up->AppendAllDIEsThatMatchingRegex(regex, hash_data))
     DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
-    ParseFunctions(offsets, info, resolve_function, include_inlines, sc_list);
-  }
 }
 
 void AppleDWARFIndex::ReportInvalidDIEOffset(dw_offset_t offset,

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h?rev=334012&r1=334011&r2=334012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.h Tue Jun  5 05:13:22 2018
@@ -47,12 +47,7 @@ public:
                     const CompilerDeclContext &parent_decl_ctx,
                     uint32_t name_type_mask,
                     std::vector<DWARFDIE> &dies) override;
-  void GetFunctions(
-      const RegularExpression &regex, DWARFDebugInfo &info,
-      llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
-                              lldb_private::SymbolContextList &sc_list)>
-          resolve_function,
-      bool include_inlines, SymbolContextList &sc_list) override;
+  void GetFunctions(const RegularExpression &regex, DIEArray &offsets) override;
 
   void ReportInvalidDIEOffset(dw_offset_t offset,
                               llvm::StringRef name) override;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp?rev=334012&r1=334011&r2=334012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.cpp Tue Jun  5 05:13:22 2018
@@ -15,17 +15,3 @@ using namespace lldb_private;
 using namespace lldb;
 
 DWARFIndex::~DWARFIndex() = default;
-
-void DWARFIndex::ParseFunctions(
-    const DIEArray &offsets, DWARFDebugInfo &info,
-    llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
-                            lldb_private::SymbolContextList &sc_list)>
-        resolve_function,
-    bool include_inlines, SymbolContextList &sc_list) {
-  const size_t num_matches = offsets.size();
-  for (size_t i = 0; i < num_matches; ++i) {
-    DWARFDIE die = info.GetDIE(offsets[i]);
-    if (die)
-      resolve_function(die, include_inlines, sc_list);
-  }
-}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h?rev=334012&r1=334011&r2=334012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFIndex.h Tue Jun  5 05:13:22 2018
@@ -40,12 +40,8 @@ public:
                             const CompilerDeclContext &parent_decl_ctx,
                             uint32_t name_type_mask,
                             std::vector<DWARFDIE> &dies) = 0;
-  virtual void GetFunctions(
-      const RegularExpression &regex, DWARFDebugInfo &info,
-      llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
-                              lldb_private::SymbolContextList &sc_list)>
-          resolve_function,
-      bool include_inlines, SymbolContextList &sc_list) = 0;
+  virtual void GetFunctions(const RegularExpression &regex,
+                            DIEArray &offsets) = 0;
 
   virtual void ReportInvalidDIEOffset(dw_offset_t offset,
                                       llvm::StringRef name) = 0;
@@ -53,13 +49,6 @@ public:
 
 protected:
   Module &m_module;
-
-  void ParseFunctions(
-      const DIEArray &offsets, DWARFDebugInfo &info,
-      llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
-                              lldb_private::SymbolContextList &sc_list)>
-          resolve_function,
-      bool include_inlines, SymbolContextList &sc_list);
 };
 } // namespace lldb_private
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp?rev=334012&r1=334011&r2=334012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp Tue Jun  5 05:13:22 2018
@@ -459,18 +459,12 @@ void ManualDWARFIndex::GetFunctions(Cons
   }
 }
 
-void ManualDWARFIndex::GetFunctions(
-    const RegularExpression &regex, DWARFDebugInfo &info,
-    llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
-                            lldb_private::SymbolContextList &sc_list)>
-        resolve_function,
-    bool include_inlines, SymbolContextList &sc_list) {
+void ManualDWARFIndex::GetFunctions(const RegularExpression &regex,
+                                    DIEArray &offsets) {
   Index();
 
-  DIEArray offsets;
   m_set.function_basenames.Find(regex, offsets);
   m_set.function_fullnames.Find(regex, offsets);
-  ParseFunctions(offsets, info, resolve_function, include_inlines, sc_list);
 }
 
 void ManualDWARFIndex::Dump(Stream &s) {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h?rev=334012&r1=334011&r2=334012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h Tue Jun  5 05:13:22 2018
@@ -35,12 +35,7 @@ public:
                     const CompilerDeclContext &parent_decl_ctx,
                     uint32_t name_type_mask,
                     std::vector<DWARFDIE> &dies) override;
-  void GetFunctions(
-      const RegularExpression &regex, DWARFDebugInfo &info,
-      llvm::function_ref<bool(const DWARFDIE &die, bool include_inlines,
-                              lldb_private::SymbolContextList &sc_list)>
-          resolve_function,
-      bool include_inlines, SymbolContextList &sc_list) override;
+  void GetFunctions(const RegularExpression &regex, DIEArray &offsets) override;
 
   void ReportInvalidDIEOffset(dw_offset_t offset,
                               llvm::StringRef name) override {}

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=334012&r1=334011&r2=334012&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Jun  5 05:13:22 2018
@@ -2278,12 +2278,11 @@ uint32_t SymbolFileDWARF::FindFunctions(
   // appending the results to a variable list.
   uint32_t original_size = sc_list.GetSize();
 
-  m_index->GetFunctions(regex, *info,
-                        [this](const DWARFDIE &die, bool include_inlines,
-                               lldb_private::SymbolContextList &sc_list) {
-                          return ResolveFunction(die, include_inlines, sc_list);
-                        },
-                        include_inlines, sc_list);
+  DIEArray offsets;
+  m_index->GetFunctions(regex, offsets);
+
+  for (DIERef ref : offsets)
+    ResolveFunction(ref, include_inlines, sc_list);
 
   // Return the number of variable that were appended to the list
   return sc_list.GetSize() - original_size;




More information about the lldb-commits mailing list