(no commit message)
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 16 Jan 2021 11:43:10 +0000 (12:43 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 16 Jan 2021 11:43:10 +0000 (12:43 +0100)
lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h

index 93b3b9a..8c7400a 100644 (file)
@@ -7,7 +7,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "Plugins/SymbolFile/DWARF/AppleDWARFIndex.h"
-#include "Plugins/SymbolFile/DWARF/DWARFCompileUnit.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDeclContext.h"
 #include "Plugins/SymbolFile/DWARF/DWARFUnit.h"
 #include "Plugins/SymbolFile/DWARF/LogChannelDWARF.h"
index c5d9e4a..7c6d0a4 100644 (file)
@@ -21,7 +21,6 @@ class CompileUnit;
 class ExecutionContext;
 }
 class SymbolFileDWARF;
-class DWARFCompileUnit;
 
 class DWARFASTParser {
 public:
index 69ea343..94c2d63 100644 (file)
@@ -13,7 +13,6 @@
 #include "DWARFDebugInfo.h"
 #include "DWARFDeclContext.h"
 #include "DWARFDefines.h"
-#include "DWARFCompileUnit.h"
 #include "SymbolFileDWARF.h"
 #include "SymbolFileDWARFDebugMap.h"
 #include "SymbolFileDWARFDwo.h"
@@ -1983,13 +1982,13 @@ bool DWARFASTParserClang::CompleteRecordType(DWARFUnit *main_unit, const DWARFDI
                                              lldb_private::Type *type,
                                              CompilerType &clang_type) {
   const dw_tag_t tag = die.Tag();
-  SymbolFileDWARF *dwarf = main_unit ? &main_unit->GetSymbolFileDWARF() : llvm::cast<SymbolFileDWARF>(type->GetSymbolContextScope()->CalculateSymbolContextModule()->GetSymbolFile());
+  SymbolFileDWARF *dwarf = &main_unit->GetSymbolFileDWARF();
   CompileUnit *comp_unit =
       type->GetSymbolContextScope()->CalculateSymbolContextCompileUnit();
   // comp_unit may be a CU with DIE being only declaration.
   // Then 'die' will be a definition in a different CU with different 'main_unit'.
-  //DWARFCompileUnit *main_unit_check = sc.GetDWARFCompileUnit(&dwarf);
-  //lldbassert(main_unit_check && &main_unit_check->GetNonSkeletonUnit() == main_unit);
+  // This assertion will therefore not work:
+  // lldbassert(&sc.GetDWARFCompileUnit(&dwarf)->GetNonSkeletonUnit() == sc.GetDWARFCompileUnit(&dwarf));
 
   ClangASTImporter::LayoutInfo layout_info;
 
@@ -2126,11 +2125,7 @@ bool DWARFASTParserClang::CompleteEnumType(const DWARFDIE &die,
 bool DWARFASTParserClang::CompleteTypeFromDWARF(DWARFUnit *main_unit, const DWARFDIE &die,
                                                 lldb_private::Type *type,
                                                 CompilerType &clang_type) {
-  SymbolFileDWARF *dwarf = main_unit ? &main_unit->GetSymbolFileDWARF() : llvm::cast<SymbolFileDWARF>(type->GetSymbolContextScope()->CalculateSymbolContextModule()->GetSymbolFile());
-  // sc.comp_unit may be a CU with DIE being only declaration.
-  // Then 'die' will be a definition in a different CU with different 'main_unit'.
-  //DWARFCompileUnit *main_unit_check = sc.GetDWARFCompileUnit(&dwarf);
-  //lldbassert(main_unit_check && &main_unit_check->GetNonSkeletonUnit() == main_unit);
+  SymbolFileDWARF *dwarf = &main_unit->GetSymbolFileDWARF();
 
   std::lock_guard<std::recursive_mutex> guard(
       dwarf->GetObjectFile()->GetModule()->GetMutex());
index b46a382..7a2cd68 100644 (file)
@@ -159,11 +159,9 @@ DWARFUnit *DWARFDebugInfo::GetUnit(const DIERef &die_ref) {
   return GetUnitContainingDIEOffset(die_ref.section(), die_ref.die_offset());
 }
 
-DWARFCompileUnit *DWARFDebugInfo::GetMainUnit(const DIERef &die_ref) {
-  DWARFUnit *cu = GetUnit(die_ref);
-  if (!cu || cu->IsTypeUnit())
-    return nullptr;
-  return llvm::cast<DWARFCompileUnit>(cu);
+DWARFUnit *DWARFDebugInfo::GetMainUnit(const DIERef &die_ref) {
+  DWARFUnit *main_unit = GetUnit(die_ref);
+  return main_unit;
 }
 
 DWARFUnit *
@@ -205,11 +203,11 @@ DWARFDIE
 DWARFDebugInfo::GetDIE(const DIERef &die_ref, DWARFUnit **main_unit_return) {
   DWARFUnit *cu = GetUnit(die_ref);
   if (cu) {
-    DWARFCompileUnit *main_cu = GetMainUnit(die_ref);
-    if (main_cu == cu)
-      cu = main_cu = &main_cu->GetNonSkeletonUnit();
+    DWARFUnit *main_unit = GetMainUnit(die_ref);
+    if (main_unit == cu)
+      cu = main_unit = &main_unit->GetNonSkeletonUnit();
     if (main_unit_return)
-      *main_unit_return = main_cu;
+      *main_unit_return = main_unit;
     return cu->GetDIE(die_ref.die_offset());
   }
   return DWARFDIE(); // Not found
index 8b5c434..ed07765 100644 (file)
@@ -41,7 +41,7 @@ public:
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,
                                         dw_offset_t die_offset);
   DWARFUnit *GetUnit(const DIERef &die_ref);
-  DWARFCompileUnit *GetMainUnit(const DIERef &die_ref);
+  DWARFUnit *GetMainUnit(const DIERef &die_ref);
   DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);
   bool ContainsTypeUnits();
   DWARFDIE GetDIEForDIEOffset(DIERef::Section section,