Merge branch 'addmainunit3-altlink' into addmainunit3-altlink-sharedstmt
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 16 Jan 2021 07:03:10 +0000 (08:03 +0100)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sat, 16 Jan 2021 07:03:10 +0000 (08:03 +0100)
1  2 
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

@@@ -377,7 -377,7 +377,7 @@@ void SymbolFileDWARF::GetTypes(SymbolCo
    if (sc_scope)
      comp_unit = sc_scope->CalculateSymbolContextCompileUnit();
  
-   const auto &get = [&](DWARFCompileUnit *unit) {
+   const auto &get = [&](DWARFUnit *unit) {
      if (!unit)
        return;
      unit = &unit->GetNonSkeletonUnit();
      DWARFDebugInfo &info = DebugInfo();
      const size_t num_cus = info.GetNumUnits();
      for (size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx)
-       get(llvm::cast_or_null<DWARFCompileUnit>(info.GetUnitAtIndex(cu_idx)));
+       get(info.GetUnitAtIndex(cu_idx));
    }
  
    std::set<CompilerType> compiler_type_set;
@@@ -920,14 -920,15 +920,14 @@@ FileSpec SymbolFileDWARF::GetFile(DWARF
      return FileSpec();
    }
  
 -  auto &tu = llvm::cast<DWARFTypeUnit>(unit);
 -  return GetTypeUnitSupportFiles(tu).GetFileSpecAtIndex(file_idx);
 +  return GetSharedUnitSupportFiles(unit).GetFileSpecAtIndex(file_idx);
  }
  
  const FileSpecList &
 -SymbolFileDWARF::GetTypeUnitSupportFiles(DWARFTypeUnit &tu) {
 +SymbolFileDWARF::GetSharedUnitSupportFiles(DWARFUnit &unit) {
    static FileSpecList empty_list;
  
 -  dw_offset_t offset = tu.GetLineTableOffset();
 +  dw_offset_t offset = unit.GetLineTableOffset();
    if (offset == DW_INVALID_OFFSET ||
        offset == llvm::DenseMapInfo<dw_offset_t>::getEmptyKey() ||
        offset == llvm::DenseMapInfo<dw_offset_t>::getTombstoneKey())
  
    // Many type units can share a line table, so parse the support file list
    // once, and cache it based on the offset field.
 -  auto iter_bool = m_type_unit_support_files.try_emplace(offset);
 +  auto iter_bool = m_shared_unit_support_files.try_emplace(offset);
    FileSpecList &list = iter_bool.first->second;
    if (iter_bool.second) {
      uint64_t line_table_offset = offset;
      auto report = [](llvm::Error error) {
        Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
        LLDB_LOG_ERROR(log, std::move(error),
 -                     "SymbolFileDWARF::GetTypeUnitSupportFiles failed to parse "
 +                     "SymbolFileDWARF::GetSharedUnitSupportFiles failed to parse "
                       "the line table prologue");
      };
      llvm::Error error = prologue.parse(data, &line_table_offset, report, ctx);
        report(std::move(error));
      } else {
        list = ParseSupportFilesFromPrologue(GetObjectFile()->GetModule(),
 -                                           prologue, tu.GetPathStyle());
 +                                           prologue, unit.GetPathStyle());
      }
    }
    return list;