[Lldb-commits] [lldb] r360443 - Finish renaming CompileUnit -> Unit

Jan Kratochvil via lldb-commits lldb-commits at lists.llvm.org
Fri May 10 10:14:38 PDT 2019


Author: jankratochvil
Date: Fri May 10 10:14:37 2019
New Revision: 360443

URL: http://llvm.org/viewvc/llvm-project?rev=360443&view=rev
Log:
Finish renaming CompileUnit -> Unit

D42892 changed a lot of code to use superclass DWARFUnit instead of its
subclass DWARFCompileUnit.

Finish this change more thoroughly for any *CompileUnit* -> *Unit* names.
Later patch will introduce DWARFTypeUnit which needs to be sometimes different
from DWARFCompileUnit and it would be confusing without this renaming.

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

Modified:
    lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
    lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.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=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp Fri May 10 10:14:37 2019
@@ -74,8 +74,8 @@ void AppleDWARFIndex::GetGlobalVariables
     return;
 
   DWARFMappedHash::DIEInfoArray hash_data;
-  if (m_apple_names_up->AppendAllDIEsInRange(
-          cu.GetOffset(), cu.GetNextCompileUnitOffset(), hash_data))
+  if (m_apple_names_up->AppendAllDIEsInRange(cu.GetOffset(),
+                                             cu.GetNextUnitOffset(), hash_data))
     DWARFMappedHash::ExtractDIEArray(hash_data, offsets);
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri May 10 10:14:37 2019
@@ -52,8 +52,7 @@ llvm::Expected<DWARFUnitSP> DWARFCompile
     cu_sp->m_addr_size = debug_info.GetU8(offset_ptr);
   }
 
-  bool length_OK =
-      debug_info.ValidOffset(cu_sp->GetNextCompileUnitOffset() - 1);
+  bool length_OK = debug_info.ValidOffset(cu_sp->GetNextUnitOffset() - 1);
   bool version_OK = SymbolFileDWARF::SupportedVersion(cu_sp->m_version);
   bool abbr_offset_OK =
       dwarf2Data->get_debug_abbrev_data().ValidOffset(abbr_offset);
@@ -85,7 +84,7 @@ void DWARFCompileUnit::Dump(Stream *s) c
             "abbr_offset = 0x%8.8x, addr_size = 0x%2.2x (next CU at "
             "{0x%8.8x})\n",
             m_offset, m_length, m_version, GetAbbrevOffset(), m_addr_size,
-            GetNextCompileUnitOffset());
+            GetNextUnitOffset());
 }
 
 uint32_t DWARFCompileUnit::GetHeaderByteSize() const {

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=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp Fri May 10 10:14:37 2019
@@ -154,7 +154,7 @@ DWARFDIE::LookupDeepestBlock(lldb::addr_
         if (cu->ContainsDIEOffset(block_die->GetOffset()))
           return DWARFDIE(cu, block_die);
         else
-          return DWARFDIE(dwarf->DebugInfo()->GetCompileUnit(
+          return DWARFDIE(dwarf->DebugInfo()->GetUnit(
                               DIERef(cu->GetOffset(), block_die->GetOffset())),
                           block_die);
       }

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Fri May 10 10:14:37 2019
@@ -29,13 +29,12 @@ using namespace std;
 
 // Constructor
 DWARFDebugInfo::DWARFDebugInfo(lldb_private::DWARFContext &context)
-    : m_dwarf2Data(NULL), m_context(context), m_compile_units(),
-      m_cu_aranges_up() {}
+    : m_dwarf2Data(NULL), m_context(context), m_units(), m_cu_aranges_up() {}
 
 // SetDwarfData
 void DWARFDebugInfo::SetDwarfData(SymbolFileDWARF *dwarf2Data) {
   m_dwarf2Data = dwarf2Data;
-  m_compile_units.clear();
+  m_units.clear();
 }
 
 llvm::Expected<DWARFDebugAranges &> DWARFDebugInfo::GetCompileUnitAranges() {
@@ -63,9 +62,9 @@ llvm::Expected<DWARFDebugAranges &> DWAR
 
   // Manually build arange data for everything that wasn't in the
   // .debug_aranges table.
-  const size_t num_compile_units = GetNumCompileUnits();
-  for (size_t idx = 0; idx < num_compile_units; ++idx) {
-    DWARFUnit *cu = GetCompileUnitAtIndex(idx);
+  const size_t num_units = GetNumUnits();
+  for (size_t idx = 0; idx < num_units; ++idx) {
+    DWARFUnit *cu = GetUnitAtIndex(idx);
 
     dw_offset_t offset = cu->GetOffset();
     if (cus_with_data.find(offset) == cus_with_data.end())
@@ -77,8 +76,8 @@ llvm::Expected<DWARFDebugAranges &> DWAR
   return *m_cu_aranges_up;
 }
 
-void DWARFDebugInfo::ParseCompileUnitHeadersIfNeeded() {
-  if (!m_compile_units.empty())
+void DWARFDebugInfo::ParseUnitHeadersIfNeeded() {
+  if (!m_units.empty())
     return;
   if (!m_dwarf2Data)
     return;
@@ -88,7 +87,7 @@ void DWARFDebugInfo::ParseCompileUnitHea
 
   while (debug_info_data.ValidOffset(offset)) {
     llvm::Expected<DWARFUnitSP> cu_sp = DWARFCompileUnit::extract(
-        m_dwarf2Data, m_compile_units.size(), debug_info_data, &offset);
+        m_dwarf2Data, m_units.size(), debug_info_data, &offset);
 
     if (!cu_sp) {
       // FIXME: Propagate this error up.
@@ -96,50 +95,48 @@ void DWARFDebugInfo::ParseCompileUnitHea
       return;
     }
 
-    // If it didn't return an error, then it should be returning a valid
-    // CompileUnit.
+    // If it didn't return an error, then it should be returning a valid Unit.
     assert(*cu_sp);
 
-    m_compile_units.push_back(*cu_sp);
+    m_units.push_back(*cu_sp);
 
-    offset = (*cu_sp)->GetNextCompileUnitOffset();
+    offset = (*cu_sp)->GetNextUnitOffset();
   }
 }
 
-size_t DWARFDebugInfo::GetNumCompileUnits() {
-  ParseCompileUnitHeadersIfNeeded();
-  return m_compile_units.size();
+size_t DWARFDebugInfo::GetNumUnits() {
+  ParseUnitHeadersIfNeeded();
+  return m_units.size();
 }
 
-DWARFUnit *DWARFDebugInfo::GetCompileUnitAtIndex(user_id_t idx) {
+DWARFUnit *DWARFDebugInfo::GetUnitAtIndex(user_id_t idx) {
   DWARFUnit *cu = NULL;
-  if (idx < GetNumCompileUnits())
-    cu = m_compile_units[idx].get();
+  if (idx < GetNumUnits())
+    cu = m_units[idx].get();
   return cu;
 }
 
-bool DWARFDebugInfo::OffsetLessThanCompileUnitOffset(
-    dw_offset_t offset, const DWARFUnitSP &cu_sp) {
+bool DWARFDebugInfo::OffsetLessThanUnitOffset(dw_offset_t offset,
+                                              const DWARFUnitSP &cu_sp) {
   return offset < cu_sp->GetOffset();
 }
 
-uint32_t DWARFDebugInfo::FindCompileUnitIndex(dw_offset_t offset) {
-  ParseCompileUnitHeadersIfNeeded();
+uint32_t DWARFDebugInfo::FindUnitIndex(dw_offset_t offset) {
+  ParseUnitHeadersIfNeeded();
 
   // llvm::lower_bound is not used as for DIE offsets it would still return
   // index +1 and GetOffset() returning index itself would be a special case.
-  auto pos = llvm::upper_bound(m_compile_units, offset,
-                               OffsetLessThanCompileUnitOffset);
-  uint32_t idx = std::distance(m_compile_units.begin(), pos);
+  auto pos = llvm::upper_bound(m_units, offset, OffsetLessThanUnitOffset);
+  uint32_t idx = std::distance(m_units.begin(), pos);
   if (idx == 0)
     return DW_INVALID_OFFSET;
   return idx - 1;
 }
 
-DWARFUnit *DWARFDebugInfo::GetCompileUnitAtOffset(dw_offset_t cu_offset,
-                                                  uint32_t *idx_ptr) {
-  uint32_t idx = FindCompileUnitIndex(cu_offset);
-  DWARFUnit *result = GetCompileUnitAtIndex(idx);
+DWARFUnit *DWARFDebugInfo::GetUnitAtOffset(dw_offset_t cu_offset,
+                                           uint32_t *idx_ptr) {
+  uint32_t idx = FindUnitIndex(cu_offset);
+  DWARFUnit *result = GetUnitAtIndex(idx);
   if (result && result->GetOffset() != cu_offset) {
     result = nullptr;
     idx = DW_INVALID_INDEX;
@@ -149,17 +146,16 @@ DWARFUnit *DWARFDebugInfo::GetCompileUni
   return result;
 }
 
-DWARFUnit *DWARFDebugInfo::GetCompileUnit(const DIERef &die_ref) {
+DWARFUnit *DWARFDebugInfo::GetUnit(const DIERef &die_ref) {
   if (die_ref.cu_offset == DW_INVALID_OFFSET)
-    return GetCompileUnitContainingDIEOffset(die_ref.die_offset);
+    return GetUnitContainingDIEOffset(die_ref.die_offset);
   else
-    return GetCompileUnitAtOffset(die_ref.cu_offset);
+    return GetUnitAtOffset(die_ref.cu_offset);
 }
 
-DWARFUnit *
-DWARFDebugInfo::GetCompileUnitContainingDIEOffset(dw_offset_t die_offset) {
-  uint32_t idx = FindCompileUnitIndex(die_offset);
-  DWARFUnit *result = GetCompileUnitAtIndex(idx);
+DWARFUnit *DWARFDebugInfo::GetUnitContainingDIEOffset(dw_offset_t die_offset) {
+  uint32_t idx = FindUnitIndex(die_offset);
+  DWARFUnit *result = GetUnitAtIndex(idx);
   if (result && !result->ContainsDIEOffset(die_offset))
     return nullptr;
   return result;
@@ -167,7 +163,7 @@ DWARFDebugInfo::GetCompileUnitContaining
 
 DWARFDIE
 DWARFDebugInfo::GetDIEForDIEOffset(dw_offset_t die_offset) {
-  DWARFUnit *cu = GetCompileUnitContainingDIEOffset(die_offset);
+  DWARFUnit *cu = GetUnitContainingDIEOffset(die_offset);
   if (cu)
     return cu->GetDIE(die_offset);
   return DWARFDIE();
@@ -178,7 +174,7 @@ DWARFDebugInfo::GetDIEForDIEOffset(dw_of
 // Get the DIE (Debug Information Entry) with the specified offset.
 DWARFDIE
 DWARFDebugInfo::GetDIE(const DIERef &die_ref) {
-  DWARFUnit *cu = GetCompileUnit(die_ref);
+  DWARFUnit *cu = GetUnit(die_ref);
   if (cu)
     return cu->GetDIE(die_ref.die_offset);
   return DWARFDIE(); // Not found

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Fri May 10 10:14:37 2019
@@ -39,12 +39,11 @@ public:
   explicit DWARFDebugInfo(lldb_private::DWARFContext &context);
   void SetDwarfData(SymbolFileDWARF *dwarf2Data);
 
-  size_t GetNumCompileUnits();
-  DWARFUnit *GetCompileUnitAtIndex(lldb::user_id_t idx);
-  DWARFUnit *GetCompileUnitAtOffset(dw_offset_t cu_offset,
-                                    uint32_t *idx_ptr = NULL);
-  DWARFUnit *GetCompileUnitContainingDIEOffset(dw_offset_t die_offset);
-  DWARFUnit *GetCompileUnit(const DIERef &die_ref);
+  size_t GetNumUnits();
+  DWARFUnit *GetUnitAtIndex(lldb::user_id_t idx);
+  DWARFUnit *GetUnitAtOffset(dw_offset_t cu_offset, uint32_t *idx_ptr = NULL);
+  DWARFUnit *GetUnitContainingDIEOffset(dw_offset_t die_offset);
+  DWARFUnit *GetUnit(const DIERef &die_ref);
   DWARFDIE GetDIEForDIEOffset(dw_offset_t die_offset);
   DWARFDIE GetDIE(const DIERef &die_ref);
 
@@ -58,24 +57,24 @@ public:
   llvm::Expected<DWARFDebugAranges &> GetCompileUnitAranges();
 
 protected:
-  static bool OffsetLessThanCompileUnitOffset(dw_offset_t offset,
-                                              const DWARFUnitSP &cu_sp);
+  static bool OffsetLessThanUnitOffset(dw_offset_t offset,
+                                       const DWARFUnitSP &cu_sp);
 
-  typedef std::vector<DWARFUnitSP> CompileUnitColl;
+  typedef std::vector<DWARFUnitSP> UnitColl;
 
   // Member variables
   SymbolFileDWARF *m_dwarf2Data;
   lldb_private::DWARFContext &m_context;
-  CompileUnitColl m_compile_units;
+  UnitColl m_units;
   std::unique_ptr<DWARFDebugAranges>
       m_cu_aranges_up; // A quick address to compile unit table
 
 private:
   // All parsing needs to be done partially any managed by this class as
   // accessors are called.
-  void ParseCompileUnitHeadersIfNeeded();
+  void ParseUnitHeadersIfNeeded();
 
-  uint32_t FindCompileUnitIndex(dw_offset_t offset);
+  uint32_t FindUnitIndex(dw_offset_t offset);
 
   DISALLOW_COPY_AND_ASSIGN(DWARFDebugInfo);
 };

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=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Fri May 10 10:14:37 2019
@@ -209,7 +209,7 @@ bool DWARFDebugInfoEntry::Extract(const
   const DWARFDataExtractor &debug_info_data = cu->GetData();
   //    const DWARFDataExtractor& debug_str_data =
   //    dwarf2Data->get_debug_str_data();
-  const uint32_t cu_end_offset = cu->GetNextCompileUnitOffset();
+  const uint32_t cu_end_offset = cu->GetNextUnitOffset();
   lldb::offset_t offset = *offset_ptr;
   //  if (offset >= cu_end_offset)
   //      Log::Status("DIE at offset 0x%8.8x is beyond the end of the current

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=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Fri May 10 10:14:37 2019
@@ -58,7 +58,7 @@ void DWARFUnit::ExtractUnitDIEIfNeeded()
   const DWARFDataExtractor &data = GetData();
   DWARFFormValue::FixedFormSizes fixed_form_sizes =
       DWARFFormValue::GetFixedFormSizesForAddressSize(GetAddressByteSize());
-  if (offset < GetNextCompileUnitOffset() &&
+  if (offset < GetNextUnitOffset() &&
       m_first_die.FastExtract(data, this, fixed_form_sizes, &offset)) {
     AddUnitDIE(m_first_die);
     return;
@@ -151,7 +151,7 @@ void DWARFUnit::ExtractDIEsRWLocked() {
   // Set the offset to that of the first DIE and calculate the start of the
   // next compilation unit header.
   lldb::offset_t offset = GetFirstDIEOffset();
-  lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
+  lldb::offset_t next_cu_offset = GetNextUnitOffset();
 
   DWARFDebugInfoEntry die;
 
@@ -366,7 +366,7 @@ size_t DWARFUnit::AppendDIEsWithTag(cons
   return dies.size() - old_size;
 }
 
-dw_offset_t DWARFUnit::GetNextCompileUnitOffset() const {
+dw_offset_t DWARFUnit::GetNextUnitOffset() const {
   return m_offset + GetLengthByteSize() + GetLength();
 }
 

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=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Fri May 10 10:14:37 2019
@@ -84,12 +84,12 @@ public:
 
   bool ContainsDIEOffset(dw_offset_t die_offset) const {
     return die_offset >= GetFirstDIEOffset() &&
-           die_offset < GetNextCompileUnitOffset();
+           die_offset < GetNextUnitOffset();
   }
   dw_offset_t GetFirstDIEOffset() const {
     return m_offset + GetHeaderByteSize();
   }
-  dw_offset_t GetNextCompileUnitOffset() const;
+  dw_offset_t GetNextUnitOffset() const;
   // Size of the CU data (without initial length and without header).
   size_t GetDebugInfoSize() const;
   // Size of the CU data incl. header but without initial length.

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp?rev=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp Fri May 10 10:14:37 2019
@@ -55,7 +55,7 @@ DIERef DebugNamesDWARFIndex::ToDIERef(co
   if (!cu_offset)
     return DIERef();
 
-  DWARFUnit *cu = m_debug_info.GetCompileUnitAtOffset(*cu_offset);
+  DWARFUnit *cu = m_debug_info.GetUnitAtOffset(*cu_offset);
   if (!cu)
     return DIERef();
 
@@ -164,7 +164,7 @@ void DebugNamesDWARFIndex::GetCompleteOb
     if (!ref)
       continue;
 
-    DWARFUnit *cu = m_debug_info.GetCompileUnitAtOffset(ref.cu_offset);
+    DWARFUnit *cu = m_debug_info.GetUnitAtOffset(ref.cu_offset);
     if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
       incomplete_types.push_back(ref);
       continue;

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=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp Fri May 10 10:14:37 2019
@@ -32,9 +32,9 @@ void ManualDWARFIndex::Index() {
   Timer scoped_timer(func_cat, "%p", static_cast<void *>(&debug_info));
 
   std::vector<DWARFUnit *> units_to_index;
-  units_to_index.reserve(debug_info.GetNumCompileUnits());
-  for (size_t U = 0; U < debug_info.GetNumCompileUnits(); ++U) {
-    DWARFUnit *unit = debug_info.GetCompileUnitAtIndex(U);
+  units_to_index.reserve(debug_info.GetNumUnits());
+  for (size_t U = 0; U < debug_info.GetNumUnits(); ++U) {
+    DWARFUnit *unit = debug_info.GetUnitAtIndex(U);
     if (unit && m_units_to_avoid.count(unit->GetOffset()) == 0)
       units_to_index.push_back(unit);
   }
@@ -43,8 +43,8 @@ void ManualDWARFIndex::Index() {
 
   std::vector<IndexSet> sets(units_to_index.size());
 
-  // Keep memory down by clearing DIEs for any compile units if indexing
-  // caused us to load the compile unit's DIEs.
+  // Keep memory down by clearing DIEs for any units if indexing
+  // caused us to load the unit's DIEs.
   std::vector<llvm::Optional<DWARFUnit::ScopedExtractDIEs>> clear_cu_dies(
       units_to_index.size());
   auto parser_fn = [&](size_t cu_idx) {
@@ -55,17 +55,17 @@ void ManualDWARFIndex::Index() {
     clear_cu_dies[cu_idx] = units_to_index[cu_idx]->ExtractDIEsScoped();
   };
 
-  // Create a task runner that extracts dies for each DWARF compile unit in a
+  // Create a task runner that extracts dies for each DWARF unit in a
   // separate thread
-  // First figure out which compile units didn't have their DIEs already
+  // First figure out which units didn't have their DIEs already
   // parsed and remember this.  If no DIEs were parsed prior to this index
   // function call, we are going to want to clear the CU dies after we are
   // done indexing to make sure we don't pull in all DWARF dies, but we need
-  // to wait until all compile units have been indexed in case a DIE in one
-  // compile unit refers to another and the indexes accesses those DIEs.
+  // to wait until all units have been indexed in case a DIE in one
+  // unit refers to another and the indexes accesses those DIEs.
   TaskMapOverInt(0, units_to_index.size(), extract_fn);
 
-  // Now create a task runner that can index each DWARF compile unit in a
+  // Now create a task runner that can index each DWARF unit in a
   // separate thread so we can index quickly.
 
   TaskMapOverInt(0, units_to_index.size(), parser_fn);
@@ -95,7 +95,7 @@ void ManualDWARFIndex::IndexUnit(DWARFUn
 
   if (log) {
     m_module.LogMessage(
-        log, "ManualDWARFIndex::IndexUnit for compile unit at .debug_info[0x%8.8x]",
+        log, "ManualDWARFIndex::IndexUnit for unit at .debug_info[0x%8.8x]",
         unit.GetOffset());
   }
 
@@ -213,7 +213,7 @@ void ManualDWARFIndex::IndexUnitImpl(
                 //   if (block_data) {
                 //     uint32_t block_length = form_value.Unsigned();
                 //     if (block_length == 1 +
-                //     attributes.CompileUnitAtIndex(i)->GetAddressByteSize()) {
+                //     attributes.UnitAtIndex(i)->GetAddressByteSize()) {
                 //       if (block_data[0] == DW_OP_addr)
                 //         add_die = true;
                 //     }

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=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri May 10 10:14:37 2019
@@ -301,13 +301,13 @@ size_t SymbolFileDWARF::GetTypes(SymbolC
     if (dwarf_cu == 0)
       return 0;
     GetTypes(dwarf_cu->DIE(), dwarf_cu->GetOffset(),
-             dwarf_cu->GetNextCompileUnitOffset(), type_mask, type_set);
+             dwarf_cu->GetNextUnitOffset(), type_mask, type_set);
   } else {
     DWARFDebugInfo *info = DebugInfo();
     if (info) {
-      const size_t num_cus = info->GetNumCompileUnits();
+      const size_t num_cus = info->GetNumUnits();
       for (size_t cu_idx = 0; cu_idx < num_cus; ++cu_idx) {
-        dwarf_cu = info->GetCompileUnitAtIndex(cu_idx);
+        dwarf_cu = info->GetUnitAtIndex(cu_idx);
         if (dwarf_cu) {
           GetTypes(dwarf_cu->DIE(), 0, UINT32_MAX, type_mask, type_set);
         }
@@ -690,7 +690,7 @@ SymbolFileDWARF::GetDWARFCompileUnit(lld
   DWARFDebugInfo *info = DebugInfo();
   if (info) {
     // The compile unit ID is the index of the DWARF unit.
-    DWARFUnit *dwarf_cu = info->GetCompileUnitAtIndex(comp_unit->GetID());
+    DWARFUnit *dwarf_cu = info->GetUnitAtIndex(comp_unit->GetID());
     if (dwarf_cu && dwarf_cu->GetUserData() == NULL)
       dwarf_cu->SetUserData(comp_unit);
     return dwarf_cu;
@@ -794,7 +794,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseC
 uint32_t SymbolFileDWARF::GetNumCompileUnits() {
   DWARFDebugInfo *info = DebugInfo();
   if (info)
-    return info->GetNumCompileUnits();
+    return info->GetNumUnits();
   return 0;
 }
 
@@ -803,7 +803,7 @@ CompUnitSP SymbolFileDWARF::ParseCompile
   CompUnitSP cu_sp;
   DWARFDebugInfo *info = DebugInfo();
   if (info) {
-    DWARFUnit *dwarf_cu = info->GetCompileUnitAtIndex(cu_idx);
+    DWARFUnit *dwarf_cu = info->GetUnitAtIndex(cu_idx);
     if (dwarf_cu)
       cu_sp = ParseCompileUnit(dwarf_cu, cu_idx);
   }
@@ -1588,7 +1588,7 @@ void SymbolFileDWARF::UpdateExternalModu
 
   const uint32_t num_compile_units = GetNumCompileUnits();
   for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
-    DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
+    DWARFUnit *dwarf_cu = debug_info->GetUnitAtIndex(cu_idx);
 
     const DWARFBaseDIE die = dwarf_cu->GetUnitDIEOnly();
     if (die && !die.HasChildren()) {
@@ -1752,8 +1752,7 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
         }
       } else {
         uint32_t cu_idx = DW_INVALID_INDEX;
-        DWARFUnit *dwarf_cu =
-            debug_info->GetCompileUnitAtOffset(cu_offset, &cu_idx);
+        DWARFUnit *dwarf_cu = debug_info->GetUnitAtOffset(cu_offset, &cu_idx);
         if (dwarf_cu) {
           sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, cu_idx);
           if (sc.comp_unit) {
@@ -1853,8 +1852,7 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
       uint32_t cu_idx;
       DWARFUnit *dwarf_cu = NULL;
 
-      for (cu_idx = 0;
-           (dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx)) != NULL;
+      for (cu_idx = 0; (dwarf_cu = debug_info->GetUnitAtIndex(cu_idx)) != NULL;
            ++cu_idx) {
         CompileUnit *dc_cu = GetCompUnitForDWARFCompUnit(dwarf_cu, cu_idx);
         const bool full_match = (bool)file_spec.GetDirectory();
@@ -2343,10 +2341,10 @@ void SymbolFileDWARF::GetMangledNamesFor
   DWARFDebugInfo *info = DebugInfo();
   uint32_t num_comp_units = 0;
   if (info)
-    num_comp_units = info->GetNumCompileUnits();
+    num_comp_units = info->GetNumUnits();
 
   for (uint32_t i = 0; i < num_comp_units; i++) {
-    DWARFUnit *cu = info->GetCompileUnitAtIndex(i);
+    DWARFUnit *cu = info->GetUnitAtIndex(i);
     if (cu == nullptr)
       continue;
 
@@ -2685,7 +2683,7 @@ bool SymbolFileDWARF::Supports_DW_AT_APP
       DWARFDebugInfo *debug_info = DebugInfo();
       const uint32_t num_compile_units = GetNumCompileUnits();
       for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
-        DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
+        DWARFUnit *dwarf_cu = debug_info->GetUnitAtIndex(cu_idx);
         if (dwarf_cu != cu &&
             dwarf_cu->Supports_DW_AT_APPLE_objc_complete_type()) {
           m_supports_DW_AT_APPLE_objc_complete_type = eLazyBoolYes;
@@ -3110,7 +3108,7 @@ size_t SymbolFileDWARF::ParseVariablesFo
         return num_variables;
       }
     } else if (sc.comp_unit) {
-      DWARFUnit *dwarf_cu = info->GetCompileUnitAtIndex(sc.comp_unit->GetID());
+      DWARFUnit *dwarf_cu = info->GetUnitAtIndex(sc.comp_unit->GetID());
 
       if (dwarf_cu == NULL)
         return 0;

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp?rev=360443&r1=360442&r2=360443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp Fri May 10 10:14:37 2019
@@ -56,7 +56,7 @@ SymbolFileDWARFDwo::ParseCompileUnit(DWA
 DWARFUnit *SymbolFileDWARFDwo::GetCompileUnit() {
   // Only dwo files with 1 compile unit is supported
   if (GetNumCompileUnits() == 1)
-    return DebugInfo()->GetCompileUnitAtIndex(0);
+    return DebugInfo()->GetUnitAtIndex(0);
   else
     return nullptr;
 }




More information about the lldb-commits mailing list