[Lldb-commits] [lldb] r355974 - Remove DWARFDIECollection.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 12 13:50:47 PDT 2019


Author: zturner
Date: Tue Mar 12 13:50:46 2019
New Revision: 355974

URL: http://llvm.org/viewvc/llvm-project?rev=355974&view=rev
Log:
Remove DWARFDIECollection.

This is a very thin wrapper over a std::vector<DWARFDIE> and does
not seem to provide any real value over just using a container
directly.

Differential Revision: https://reviews.llvm.org/D59165

Removed:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h
Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Tue Mar 12 13:50:46 2019
@@ -21,7 +21,6 @@ add_lldb_library(lldbPluginSymbolFileDWA
   DWARFDeclContext.cpp
   DWARFDefines.cpp
   DWARFDIE.cpp
-  DWARFDIECollection.cpp
   DWARFFormValue.cpp
   DWARFIndex.cpp
   DWARFUnit.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Tue Mar 12 13:50:46 2019
@@ -10,7 +10,6 @@
 
 #include "DWARFASTParserClang.h"
 #include "DWARFDIE.h"
-#include "DWARFDIECollection.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
 #include "DWARFDefines.h"
@@ -1393,7 +1392,7 @@ TypeSP DWARFASTParserClang::ParseTypeFro
                         DIERef(class_type->GetID(), dwarf));
                   }
                   if (class_type_die) {
-                    DWARFDIECollection failures;
+                    std::vector<DWARFDIE> failures;
 
                     CopyUniqueClassMethodTypes(decl_ctx_die, class_type_die,
                                                class_type, failures);
@@ -2194,7 +2193,7 @@ bool DWARFASTParserClang::CompleteTypeFr
         std::vector<int> member_accessibilities;
         bool is_a_class = false;
         // Parse members and base classes first
-        DWARFDIECollection member_function_dies;
+        std::vector<DWARFDIE> member_function_dies;
 
         DelayedPropertyList delayed_properties;
         ParseChildMembers(sc, die, clang_type, class_language, bases,
@@ -2203,12 +2202,8 @@ bool DWARFASTParserClang::CompleteTypeFr
                           layout_info);
 
         // Now parse any methods if there were any...
-        size_t num_functions = member_function_dies.Size();
-        if (num_functions > 0) {
-          for (size_t i = 0; i < num_functions; ++i) {
-            dwarf->ResolveType(member_function_dies.GetDIEAtIndex(i));
-          }
-        }
+        for (const DWARFDIE &die : member_function_dies)
+          dwarf->ResolveType(die);
 
         if (class_language == eLanguageTypeObjC) {
           ConstString class_name(clang_type.GetTypeName());
@@ -2677,7 +2672,7 @@ bool DWARFASTParserClang::ParseChildMemb
     CompilerType &class_clang_type, const LanguageType class_language,
     std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
     std::vector<int> &member_accessibilities,
-    DWARFDIECollection &member_function_dies,
+    std::vector<DWARFDIE> &member_function_dies,
     DelayedPropertyList &delayed_properties, AccessType &default_accessibility,
     bool &is_a_class, ClangASTImporter::LayoutInfo &layout_info) {
   if (!parent_die)
@@ -3176,7 +3171,7 @@ bool DWARFASTParserClang::ParseChildMemb
 
     case DW_TAG_subprogram:
       // Let the type parsing code handle this one for us.
-      member_function_dies.Append(die);
+      member_function_dies.push_back(die);
       break;
 
     case DW_TAG_inheritance: {
@@ -3872,7 +3867,7 @@ void DWARFASTParserClang::LinkDeclContex
 
 bool DWARFASTParserClang::CopyUniqueClassMethodTypes(
     const DWARFDIE &src_class_die, const DWARFDIE &dst_class_die,
-    lldb_private::Type *class_type, DWARFDIECollection &failures) {
+    lldb_private::Type *class_type, std::vector<DWARFDIE> &failures) {
   if (!class_type || !src_class_die || !dst_class_die)
     return false;
   if (src_class_die.Tag() != dst_class_die.Tag())
@@ -4077,7 +4072,7 @@ bool DWARFASTParserClang::CopyUniqueClas
             log->Printf("warning: couldn't find a match for 0x%8.8x",
                         dst_die.GetOffset());
 
-          failures.Append(dst_die);
+          failures.push_back(dst_die);
         }
       }
     }
@@ -4142,9 +4137,9 @@ bool DWARFASTParserClang::CopyUniqueClas
                     "method '%s'",
                     dst_die.GetOffset(), dst_name_artificial.GetCString());
 
-      failures.Append(dst_die);
+      failures.push_back(dst_die);
     }
   }
 
-  return (failures.Size() != 0);
+  return !failures.empty();
 }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h Tue Mar 12 13:50:46 2019
@@ -21,11 +21,12 @@
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/ClangASTImporter.h"
 
+#include <vector>
+
 namespace lldb_private {
 class CompileUnit;
 }
 class DWARFDebugInfoEntry;
-class DWARFDIECollection;
 class SymbolFileDWARF;
 
 class DWARFASTParserClang : public DWARFASTParser {
@@ -85,7 +86,7 @@ protected:
       const lldb::LanguageType class_language,
       std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> &base_classes,
       std::vector<int> &member_accessibilities,
-      DWARFDIECollection &member_function_dies,
+      std::vector<DWARFDIE> &member_function_dies,
       DelayedPropertyList &delayed_properties,
       lldb::AccessType &default_accessibility, bool &is_a_class,
       lldb_private::ClangASTImporter::LayoutInfo &layout_info);
@@ -117,7 +118,7 @@ protected:
   bool CopyUniqueClassMethodTypes(const DWARFDIE &src_class_die,
                                   const DWARFDIE &dst_class_die,
                                   lldb_private::Type *class_type,
-                                  DWARFDIECollection &failures);
+                                  std::vector<DWARFDIE> &failures);
 
   clang::DeclContext *GetCachedClangDeclContextForDIE(const DWARFDIE &die);
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h Tue Mar 12 13:50:46 2019
@@ -18,7 +18,6 @@ class DWARFAttributes;
 class DWARFUnit;
 class DWARFDebugInfoEntry;
 class DWARFDeclContext;
-class DWARFDIECollection;
 class SymbolFileDWARF;
 
 class DWARFBaseDIE {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp Tue Mar 12 13:50:46 2019
@@ -9,7 +9,6 @@
 #include "DWARFDIE.h"
 
 #include "DWARFASTParser.h"
-#include "DWARFDIECollection.h"
 #include "DWARFDebugInfo.h"
 #include "DWARFDebugInfoEntry.h"
 #include "DWARFDeclContext.h"
@@ -200,15 +199,18 @@ lldb_private::Type *DWARFDIE::ResolveTyp
     return nullptr;
 }
 
-void DWARFDIE::GetDeclContextDIEs(DWARFDIECollection &decl_context_dies) const {
-  if (IsValid()) {
-    DWARFDIE parent_decl_ctx_die =
-        m_die->GetParentDeclContextDIE(GetDWARF(), GetCU());
-    if (parent_decl_ctx_die && parent_decl_ctx_die.GetDIE() != GetDIE()) {
-      decl_context_dies.Append(parent_decl_ctx_die);
-      parent_decl_ctx_die.GetDeclContextDIEs(decl_context_dies);
-    }
+std::vector<DWARFDIE> DWARFDIE::GetDeclContextDIEs() const {
+  if (!IsValid())
+    return {};
+
+  std::vector<DWARFDIE> result;
+  DWARFDIE parent = GetParentDeclContextDIE();
+  while (parent.IsValid() && parent.GetDIE() != GetDIE()) {
+    result.push_back(std::move(parent));
+    parent = parent.GetParentDeclContextDIE();
   }
+
+  return result;
 }
 
 void DWARFDIE::GetDWARFDeclContext(DWARFDeclContext &dwarf_decl_ctx) const {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h Tue Mar 12 13:50:46 2019
@@ -81,7 +81,7 @@ public:
   //----------------------------------------------------------------------
   // DeclContext related functions
   //----------------------------------------------------------------------
-  void GetDeclContextDIEs(DWARFDIECollection &decl_context_dies) const;
+  std::vector<DWARFDIE> GetDeclContextDIEs() const;
 
   void GetDWARFDeclContext(DWARFDeclContext &dwarf_decl_ctx) const;
 

Removed: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp?rev=355973&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp (removed)
@@ -1,34 +0,0 @@
-//===-- DWARFDIECollection.cpp ----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "DWARFDIECollection.h"
-
-#include <algorithm>
-
-#include "lldb/Utility/Stream.h"
-
-using namespace lldb_private;
-using namespace std;
-
-void DWARFDIECollection::Append(const DWARFDIE &die) { m_dies.push_back(die); }
-
-DWARFDIE
-DWARFDIECollection::GetDIEAtIndex(uint32_t idx) const {
-  if (idx < m_dies.size())
-    return m_dies[idx];
-  return DWARFDIE();
-}
-
-size_t DWARFDIECollection::Size() const { return m_dies.size(); }
-
-void DWARFDIECollection::Dump(Stream *s, const char *title) const {
-  if (title && title[0] != '\0')
-    s->Printf("%s\n", title);
-  for (const auto &die : m_dies)
-    s->Printf("0x%8.8x\n", die.GetOffset());
-}

Removed: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h?rev=355973&view=auto
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h (removed)
@@ -1,37 +0,0 @@
-//===-- DWARFDIECollection.h ------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef SymbolFileDWARF_DWARFDIECollection_h_
-#define SymbolFileDWARF_DWARFDIECollection_h_
-
-#include "DWARFDIE.h"
-#include <vector>
-
-class DWARFDIECollection {
-public:
-  DWARFDIECollection() : m_dies() {}
-  ~DWARFDIECollection() {}
-
-  void Append(const DWARFDIE &die);
-
-  void Dump(lldb_private::Stream *s, const char *title) const;
-
-  DWARFDIE
-  GetDIEAtIndex(uint32_t idx) const;
-
-  size_t Size() const;
-
-protected:
-  typedef std::vector<DWARFDIE> collection;
-  typedef collection::iterator iterator;
-  typedef collection::const_iterator const_iterator;
-
-  collection m_dies; // Ordered list of die offsets
-};
-
-#endif // SymbolFileDWARF_DWARFDIECollection_h_

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue Mar 12 13:50:46 2019
@@ -18,7 +18,6 @@
 #include "lldb/Utility/Stream.h"
 
 #include "DWARFUnit.h"
-#include "DWARFDIECollection.h"
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
@@ -1381,11 +1380,11 @@ void DWARFDebugInfoEntry::BuildFunctionA
   }
 }
 
-void DWARFDebugInfoEntry::GetDeclContextDIEs(
-    DWARFUnit *cu, DWARFDIECollection &decl_context_dies) const {
+std::vector<DWARFDIE>
+DWARFDebugInfoEntry::GetDeclContextDIEs(DWARFUnit *cu) const {
 
   DWARFDIE die(cu, const_cast<DWARFDebugInfoEntry *>(this));
-  die.GetDeclContextDIEs(decl_context_dies);
+  return die.GetDeclContextDIEs();
 }
 
 void DWARFDebugInfoEntry::GetDWARFDeclContext(

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue Mar 12 13:50:46 2019
@@ -230,8 +230,7 @@ public:
     return HasChildren() ? this + 1 : NULL;
   }
 
-  void GetDeclContextDIEs(DWARFUnit *cu,
-                          DWARFDIECollection &decl_context_dies) const;
+  std::vector<DWARFDIE> GetDeclContextDIEs(DWARFUnit *cu) const;
 
   void GetDWARFDeclContext(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,
                            DWARFDeclContext &dwarf_decl_ctx) const;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue Mar 12 13:50:46 2019
@@ -17,7 +17,6 @@
 #include "lldb/Utility/StreamString.h"
 #include "lldb/Utility/Timer.h"
 
-#include "DWARFDIECollection.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
 #include "LogChannelDWARF.h"
@@ -400,24 +399,23 @@ DWARFDIE DWARFUnit::LookupAddress(const
 }
 
 size_t DWARFUnit::AppendDIEsWithTag(const dw_tag_t tag,
-				    DWARFDIECollection &dies,
-				    uint32_t depth) const {
-  size_t old_size = dies.Size();
+                                    std::vector<DWARFDIE> &dies,
+                                    uint32_t depth) const {
+  size_t old_size = dies.size();
   {
     llvm::sys::ScopedReader lock(m_die_array_mutex);
     DWARFDebugInfoEntry::const_iterator pos;
     DWARFDebugInfoEntry::const_iterator end = m_die_array.end();
     for (pos = m_die_array.begin(); pos != end; ++pos) {
       if (pos->Tag() == tag)
-        dies.Append(DWARFDIE(this, &(*pos)));
+        dies.emplace_back(this, &(*pos));
     }
   }
 
   // Return the number of DIEs added to the collection
-  return dies.Size() - old_size;
+  return dies.size() - old_size;
 }
 
-
 lldb::user_id_t DWARFUnit::GetID() const {
   dw_offset_t local_id =
       m_base_obj_offset != DW_INVALID_OFFSET ? m_base_obj_offset : m_offset;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Tue Mar 12 13:50:46 2019
@@ -54,8 +54,7 @@ public:
   ScopedExtractDIEs ExtractDIEsScoped();
 
   DWARFDIE LookupAddress(const dw_addr_t address);
-  size_t AppendDIEsWithTag(const dw_tag_t tag,
-                           DWARFDIECollection &matching_dies,
+  size_t AppendDIEsWithTag(const dw_tag_t tag, std::vector<DWARFDIE> &dies,
                            uint32_t depth = UINT32_MAX) const;
   bool Verify(lldb_private::Stream *s) const;
   virtual void Dump(lldb_private::Stream *s) const = 0;

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=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Mar 12 13:50:46 2019
@@ -54,7 +54,6 @@
 #include "AppleDWARFIndex.h"
 #include "DWARFASTParser.h"
 #include "DWARFASTParserClang.h"
-#include "DWARFDIECollection.h"
 #include "DWARFDebugAbbrev.h"
 #include "DWARFDebugAranges.h"
 #include "DWARFDebugInfo.h"
@@ -861,22 +860,20 @@ lldb::LanguageType SymbolFileDWARF::Pars
 
 size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) {
   ASSERT_MODULE_LOCK(this);
-  size_t functions_added = 0;
   DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
-  if (dwarf_cu) {
-    DWARFDIECollection function_dies;
-    const size_t num_functions =
-        dwarf_cu->AppendDIEsWithTag(DW_TAG_subprogram, function_dies);
-    size_t func_idx;
-    for (func_idx = 0; func_idx < num_functions; ++func_idx) {
-      DWARFDIE die = function_dies.GetDIEAtIndex(func_idx);
-      if (comp_unit.FindFunctionByUID(die.GetID()).get() == NULL) {
-        if (ParseFunction(comp_unit, die))
-          ++functions_added;
-      }
-    }
-    // FixupTypes();
+  if (!dwarf_cu)
+    return 0;
+
+  size_t functions_added = 0;
+  std::vector<DWARFDIE> function_dies;
+  dwarf_cu->AppendDIEsWithTag(DW_TAG_subprogram, function_dies);
+  for (const DWARFDIE &die : function_dies) {
+    if (comp_unit.FindFunctionByUID(die.GetID()))
+      continue;
+    if (ParseFunction(comp_unit, die))
+      ++functions_added;
   }
+  // FixupTypes();
   return functions_added;
 }
 
@@ -2807,8 +2804,8 @@ bool SymbolFileDWARF::DIEDeclContextsMat
   if (die1 == die2)
     return true;
 
-  DWARFDIECollection decl_ctx_1;
-  DWARFDIECollection decl_ctx_2;
+  std::vector<DWARFDIE> decl_ctx_1;
+  std::vector<DWARFDIE> decl_ctx_2;
   // The declaration DIE stack is a stack of the declaration context DIEs all
   // the way back to the compile unit. If a type "T" is declared inside a class
   // "B", and class "B" is declared inside a class "A" and class "A" is in a
@@ -2824,11 +2821,11 @@ bool SymbolFileDWARF::DIEDeclContextsMat
   // back to the compiler unit.
 
   // First lets grab the decl contexts for both DIEs
-  die1.GetDeclContextDIEs(decl_ctx_1);
-  die2.GetDeclContextDIEs(decl_ctx_2);
+  decl_ctx_1 = die1.GetDeclContextDIEs();
+  decl_ctx_2 = die2.GetDeclContextDIEs();
   // Make sure the context arrays have the same size, otherwise we are done
-  const size_t count1 = decl_ctx_1.Size();
-  const size_t count2 = decl_ctx_2.Size();
+  const size_t count1 = decl_ctx_1.size();
+  const size_t count2 = decl_ctx_2.size();
   if (count1 != count2)
     return false;
 
@@ -2838,8 +2835,8 @@ bool SymbolFileDWARF::DIEDeclContextsMat
   DWARFDIE decl_ctx_die2;
   size_t i;
   for (i = 0; i < count1; i++) {
-    decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i);
-    decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i);
+    decl_ctx_die1 = decl_ctx_1[i];
+    decl_ctx_die2 = decl_ctx_2[i];
     if (decl_ctx_die1.Tag() != decl_ctx_die2.Tag())
       return false;
   }
@@ -2849,7 +2846,7 @@ bool SymbolFileDWARF::DIEDeclContextsMat
   // DW_TAG_compile_unit or DW_TAG_partial_unit. If it isn't then
   // something went wrong in the DWARFDIE::GetDeclContextDIEs()
   // function.
-  dw_tag_t cu_tag = decl_ctx_1.GetDIEAtIndex(count1 - 1).Tag();
+  dw_tag_t cu_tag = decl_ctx_1[count1 - 1].Tag();
   UNUSED_IF_ASSERT_DISABLED(cu_tag);
   assert(cu_tag == DW_TAG_compile_unit || cu_tag == DW_TAG_partial_unit);
 
@@ -2857,8 +2854,8 @@ bool SymbolFileDWARF::DIEDeclContextsMat
   // Always skip the compile unit when comparing by only iterating up to "count
   // - 1". Here we compare the names as we go.
   for (i = 0; i < count1 - 1; i++) {
-    decl_ctx_die1 = decl_ctx_1.GetDIEAtIndex(i);
-    decl_ctx_die2 = decl_ctx_2.GetDIEAtIndex(i);
+    decl_ctx_die1 = decl_ctx_1[i];
+    decl_ctx_die2 = decl_ctx_2[i];
     const char *name1 = decl_ctx_die1.GetName();
     const char *name2 = decl_ctx_die2.GetName();
     // If the string was from a DW_FORM_strp, then the pointer will often be

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=355974&r1=355973&r2=355974&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Tue Mar 12 13:50:46 2019
@@ -49,7 +49,6 @@ class DWARFDebugInfoEntry;
 class DWARFDebugLine;
 class DWARFDebugRangesBase;
 class DWARFDeclContext;
-class DWARFDIECollection;
 class DWARFFormValue;
 class SymbolFileDWARFDebugMap;
 class SymbolFileDWARFDwo;




More information about the lldb-commits mailing list