[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-29 Thread Pavel Labath via lldb-commits

https://github.com/labath closed https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-29 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan approved this pull request.

LGTM! 

https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-29 Thread Pavel Labath via lldb-commits


@@ -195,17 +195,17 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
 if (!ref)
   continue;
 
-DWARFUnit *cu = m_debug_info.GetUnit(*ref);
-if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
-  incomplete_types.push_back(*ref);
-  continue;
-}
-
-DWARFDIE die = m_debug_info.GetDIE(*ref);
+SymbolFileDWARF  = *llvm::cast(
+m_module.GetSymbolFile()->GetBackingSymbolFile());

labath wrote:

And the future is here.

https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-29 Thread Pavel Labath via lldb-commits

https://github.com/labath updated 
https://github.com/llvm/llvm-project/pull/92894

>From e416051b09147b1083765795f711bb972e42a893 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Mon, 20 May 2024 14:51:52 +
Subject: [PATCH] [lldb] Remove DWARFDebugInfo DIERef footguns

DWARFDebugInfo doesn't know how to resolve the "file_index" component of
a DIERef. This patch removes GetUnit (in favor of existing
GetUnitContainingDIEOffset) and changes GetDIE to take only the
components it actually uses.

In the process it fixes GetCompleteObjCClass, although that bug was
unlikely to be noticed, since ObjC is only really used on darwin, and
split DWARF isn't a thing there.
---
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp| 11 +++
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h  |  3 +--
 .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp  | 14 +++---
 .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp   |  7 ---
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp|  2 +-
 5 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index d28da728728e5..c37cc91e08ed1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -222,10 +222,6 @@ DWARFUnit *DWARFDebugInfo::GetUnitAtOffset(DIERef::Section 
section,
   return result;
 }
 
-DWARFUnit *DWARFDebugInfo::GetUnit(const DIERef _ref) {
-  return GetUnitContainingDIEOffset(die_ref.section(), die_ref.die_offset());
-}
-
 DWARFUnit *
 DWARFDebugInfo::GetUnitContainingDIEOffset(DIERef::Section section,
dw_offset_t die_offset) {
@@ -253,9 +249,8 @@ bool DWARFDebugInfo::ContainsTypeUnits() {
 //
 // Get the DIE (Debug Information Entry) with the specified offset.
 DWARFDIE
-DWARFDebugInfo::GetDIE(const DIERef _ref) {
-  DWARFUnit *cu = GetUnit(die_ref);
-  if (cu)
-return cu->GetNonSkeletonUnit().GetDIE(die_ref.die_offset());
+DWARFDebugInfo::GetDIE(DIERef::Section section, dw_offset_t die_offset) {
+  if (DWARFUnit *cu = GetUnitContainingDIEOffset(section, die_offset))
+return cu->GetNonSkeletonUnit().GetDIE(die_offset);
   return DWARFDIE(); // Not found
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index 456ebd908ccb2..4706b55d38ea9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -38,11 +38,10 @@ class DWARFDebugInfo {
  uint32_t *idx_ptr = nullptr);
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,
 dw_offset_t die_offset);
-  DWARFUnit *GetUnit(const DIERef _ref);
   DWARFUnit *GetSkeletonUnit(DWARFUnit *dwo_unit);
   DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);
   bool ContainsTypeUnits();
-  DWARFDIE GetDIE(const DIERef _ref);
+  DWARFDIE GetDIE(DIERef::Section section, dw_offset_t die_offset);
 
   enum {
 eDumpFlag_Verbose = (1 << 0),  // Verbose dumping
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 79400e36e04f3..31bbad3e56269 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -195,17 +195,17 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
 if (!ref)
   continue;
 
-DWARFUnit *cu = m_debug_info.GetUnit(*ref);
-if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
-  incomplete_types.push_back(*ref);
-  continue;
-}
-
-DWARFDIE die = m_debug_info.GetDIE(*ref);
+SymbolFileDWARF  = *llvm::cast(
+m_module.GetSymbolFile()->GetBackingSymbolFile());
+DWARFDIE die = dwarf.GetDIE(*ref);
 if (!die) {
   ReportInvalidDIERef(*ref, class_name.GetStringRef());
   continue;
 }
+if (!die.GetCU()->Supports_DW_AT_APPLE_objc_complete_type()) {
+  incomplete_types.push_back(*ref);
+  continue;
+}
 
 if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 0)) {
   // If we find the complete version we're done.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f6f152726bf74..2bca27936c76b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1748,7 +1748,8 @@ SymbolFileDWARF::GetDIE(const DIERef _ref) {
 if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile()) {
   symbol_file = debug_map->GetSymbolFileByOSOIndex(*file_index); // OSO 
case
   if (symbol_file)
-return symbol_file->DebugInfo().GetDIE(die_ref);
+return 

[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-24 Thread Pavel Labath via lldb-commits


@@ -195,17 +195,17 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
 if (!ref)
   continue;
 
-DWARFUnit *cu = m_debug_info.GetUnit(*ref);
-if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
-  incomplete_types.push_back(*ref);
-  continue;
-}
-
-DWARFDIE die = m_debug_info.GetDIE(*ref);
+SymbolFileDWARF  = *llvm::cast(
+m_module.GetSymbolFile()->GetBackingSymbolFile());

labath wrote:

See #93296 for the new implementation. I'll update this PR after that lands.

https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-23 Thread Pavel Labath via lldb-commits


@@ -195,17 +195,17 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
 if (!ref)
   continue;
 
-DWARFUnit *cu = m_debug_info.GetUnit(*ref);
-if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
-  incomplete_types.push_back(*ref);
-  continue;
-}
-
-DWARFDIE die = m_debug_info.GetDIE(*ref);
+SymbolFileDWARF  = *llvm::cast(
+m_module.GetSymbolFile()->GetBackingSymbolFile());

labath wrote:

I was going to say that these can't be null, because then we wouldn't exist 
(the index is created by the symbol file, which is created by the module), but 
then I realized that the SymbolFile of a module can change during its lifetime 
(it rarely does, but it can), which would wreak havoc here (and elsewhere). So 
I'm going to do something even better instead. Hang on..

https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-22 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan edited 
https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-22 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan edited 
https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-22 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan edited 
https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-22 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -195,17 +195,17 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
 if (!ref)
   continue;
 
-DWARFUnit *cu = m_debug_info.GetUnit(*ref);
-if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
-  incomplete_types.push_back(*ref);
-  continue;
-}
-
-DWARFDIE die = m_debug_info.GetDIE(*ref);
+SymbolFileDWARF  = *llvm::cast(
+m_module.GetSymbolFile()->GetBackingSymbolFile());

felipepiovezan wrote:

This concerns me a little because `GetSymbolFile()` can fail (and so does 
GetBackingSymbolFile), and we're doing this somewhat expensive operation inside 
a loop, even though they are loop invariant.

We can probably address both of these issues by hoisting this outside the loop, 
computing the range, early exiting if the range is empty, and then setting up 
the symbol file. Something like:

```
auto range = m_debug_names_up->equal_range(class_name.GetStringRef()
if (range.empty()) return;

auto *symbolfile = m_module.GetSymbolFile();
if (!symbolfile) ...
if (!backing symbol file)...

// maybe just wrap all the lines above into a helper function

for (const DebugNames::Entry  :
   m_debug_names_up->equal_range(class_name.GetStringRef())) {
...
```



```

https://github.com/llvm/llvm-project/pull/92894
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-21 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)


Changes

DWARFDebugInfo doesn't know how to resolve the "file_index" component of a 
DIERef. This patch removes GetUnit (in favor of existing 
GetUnitContainingDIEOffset) and changes GetDIE to take only the components it 
actually uses.

In the process it fixes GetCompleteObjCClass, although that bug was unlikely to 
be noticed, since ObjC is only really used on darwin, and split DWARF isn't a 
thing there.

---
Full diff: https://github.com/llvm/llvm-project/pull/92894.diff


5 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (+3-8) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (+1-2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
(+7-7) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+4-3) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (+1-1) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index d28da728728e5..c37cc91e08ed1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -222,10 +222,6 @@ DWARFUnit *DWARFDebugInfo::GetUnitAtOffset(DIERef::Section 
section,
   return result;
 }
 
-DWARFUnit *DWARFDebugInfo::GetUnit(const DIERef _ref) {
-  return GetUnitContainingDIEOffset(die_ref.section(), die_ref.die_offset());
-}
-
 DWARFUnit *
 DWARFDebugInfo::GetUnitContainingDIEOffset(DIERef::Section section,
dw_offset_t die_offset) {
@@ -253,9 +249,8 @@ bool DWARFDebugInfo::ContainsTypeUnits() {
 //
 // Get the DIE (Debug Information Entry) with the specified offset.
 DWARFDIE
-DWARFDebugInfo::GetDIE(const DIERef _ref) {
-  DWARFUnit *cu = GetUnit(die_ref);
-  if (cu)
-return cu->GetNonSkeletonUnit().GetDIE(die_ref.die_offset());
+DWARFDebugInfo::GetDIE(DIERef::Section section, dw_offset_t die_offset) {
+  if (DWARFUnit *cu = GetUnitContainingDIEOffset(section, die_offset))
+return cu->GetNonSkeletonUnit().GetDIE(die_offset);
   return DWARFDIE(); // Not found
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index 456ebd908ccb2..4706b55d38ea9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -38,11 +38,10 @@ class DWARFDebugInfo {
  uint32_t *idx_ptr = nullptr);
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,
 dw_offset_t die_offset);
-  DWARFUnit *GetUnit(const DIERef _ref);
   DWARFUnit *GetSkeletonUnit(DWARFUnit *dwo_unit);
   DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);
   bool ContainsTypeUnits();
-  DWARFDIE GetDIE(const DIERef _ref);
+  DWARFDIE GetDIE(DIERef::Section section, dw_offset_t die_offset);
 
   enum {
 eDumpFlag_Verbose = (1 << 0),  // Verbose dumping
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 79400e36e04f3..31bbad3e56269 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -195,17 +195,17 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
 if (!ref)
   continue;
 
-DWARFUnit *cu = m_debug_info.GetUnit(*ref);
-if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
-  incomplete_types.push_back(*ref);
-  continue;
-}
-
-DWARFDIE die = m_debug_info.GetDIE(*ref);
+SymbolFileDWARF  = *llvm::cast(
+m_module.GetSymbolFile()->GetBackingSymbolFile());
+DWARFDIE die = dwarf.GetDIE(*ref);
 if (!die) {
   ReportInvalidDIERef(*ref, class_name.GetStringRef());
   continue;
 }
+if (!die.GetCU()->Supports_DW_AT_APPLE_objc_complete_type()) {
+  incomplete_types.push_back(*ref);
+  continue;
+}
 
 if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 0)) {
   // If we find the complete version we're done.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f6f152726bf74..2bca27936c76b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1748,7 +1748,8 @@ SymbolFileDWARF::GetDIE(const DIERef _ref) {
 if (SymbolFileDWARFDebugMap *debug_map = GetDebugMapSymfile()) {
   symbol_file = debug_map->GetSymbolFileByOSOIndex(*file_index); // OSO 
case
   if (symbol_file)
-return symbol_file->DebugInfo().GetDIE(die_ref);
+return symbol_file->DebugInfo().GetDIE(die_ref.section(),
+   

[Lldb-commits] [lldb] [lldb] Remove DWARFDebugInfo DIERef footguns (PR #92894)

2024-05-21 Thread Pavel Labath via lldb-commits

https://github.com/labath created 
https://github.com/llvm/llvm-project/pull/92894

DWARFDebugInfo doesn't know how to resolve the "file_index" component of a 
DIERef. This patch removes GetUnit (in favor of existing 
GetUnitContainingDIEOffset) and changes GetDIE to take only the components it 
actually uses.

In the process it fixes GetCompleteObjCClass, although that bug was unlikely to 
be noticed, since ObjC is only really used on darwin, and split DWARF isn't a 
thing there.

>From e416051b09147b1083765795f711bb972e42a893 Mon Sep 17 00:00:00 2001
From: Pavel Labath 
Date: Mon, 20 May 2024 14:51:52 +
Subject: [PATCH] [lldb] Remove DWARFDebugInfo DIERef footguns

DWARFDebugInfo doesn't know how to resolve the "file_index" component of
a DIERef. This patch removes GetUnit (in favor of existing
GetUnitContainingDIEOffset) and changes GetDIE to take only the
components it actually uses.

In the process it fixes GetCompleteObjCClass, although that bug was
unlikely to be noticed, since ObjC is only really used on darwin, and
split DWARF isn't a thing there.
---
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp| 11 +++
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h  |  3 +--
 .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp  | 14 +++---
 .../Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp   |  7 ---
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp|  2 +-
 5 files changed, 16 insertions(+), 21 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index d28da728728e5..c37cc91e08ed1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -222,10 +222,6 @@ DWARFUnit *DWARFDebugInfo::GetUnitAtOffset(DIERef::Section 
section,
   return result;
 }
 
-DWARFUnit *DWARFDebugInfo::GetUnit(const DIERef _ref) {
-  return GetUnitContainingDIEOffset(die_ref.section(), die_ref.die_offset());
-}
-
 DWARFUnit *
 DWARFDebugInfo::GetUnitContainingDIEOffset(DIERef::Section section,
dw_offset_t die_offset) {
@@ -253,9 +249,8 @@ bool DWARFDebugInfo::ContainsTypeUnits() {
 //
 // Get the DIE (Debug Information Entry) with the specified offset.
 DWARFDIE
-DWARFDebugInfo::GetDIE(const DIERef _ref) {
-  DWARFUnit *cu = GetUnit(die_ref);
-  if (cu)
-return cu->GetNonSkeletonUnit().GetDIE(die_ref.die_offset());
+DWARFDebugInfo::GetDIE(DIERef::Section section, dw_offset_t die_offset) {
+  if (DWARFUnit *cu = GetUnitContainingDIEOffset(section, die_offset))
+return cu->GetNonSkeletonUnit().GetDIE(die_offset);
   return DWARFDIE(); // Not found
 }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index 456ebd908ccb2..4706b55d38ea9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -38,11 +38,10 @@ class DWARFDebugInfo {
  uint32_t *idx_ptr = nullptr);
   DWARFUnit *GetUnitContainingDIEOffset(DIERef::Section section,
 dw_offset_t die_offset);
-  DWARFUnit *GetUnit(const DIERef _ref);
   DWARFUnit *GetSkeletonUnit(DWARFUnit *dwo_unit);
   DWARFTypeUnit *GetTypeUnitForHash(uint64_t hash);
   bool ContainsTypeUnits();
-  DWARFDIE GetDIE(const DIERef _ref);
+  DWARFDIE GetDIE(DIERef::Section section, dw_offset_t die_offset);
 
   enum {
 eDumpFlag_Verbose = (1 << 0),  // Verbose dumping
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 79400e36e04f3..31bbad3e56269 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -195,17 +195,17 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
 if (!ref)
   continue;
 
-DWARFUnit *cu = m_debug_info.GetUnit(*ref);
-if (!cu || !cu->Supports_DW_AT_APPLE_objc_complete_type()) {
-  incomplete_types.push_back(*ref);
-  continue;
-}
-
-DWARFDIE die = m_debug_info.GetDIE(*ref);
+SymbolFileDWARF  = *llvm::cast(
+m_module.GetSymbolFile()->GetBackingSymbolFile());
+DWARFDIE die = dwarf.GetDIE(*ref);
 if (!die) {
   ReportInvalidDIERef(*ref, class_name.GetStringRef());
   continue;
 }
+if (!die.GetCU()->Supports_DW_AT_APPLE_objc_complete_type()) {
+  incomplete_types.push_back(*ref);
+  continue;
+}
 
 if (die.GetAttributeValueAsUnsigned(DW_AT_APPLE_objc_complete_type, 0)) {
   // If we find the complete version we're done.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f6f152726bf74..2bca27936c76b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++