[Lldb-commits] [lldb] cec33fc - [lldb] Consider TAG_imported_declaration in DebugNamesIndex

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Sat Jul 8 06:17:02 PDT 2023


Author: Felipe de Azevedo Piovezan
Date: 2023-07-08T09:16:11-04:00
New Revision: cec33fc87c0c0094b0d627031ff756b2d1f905eb

URL: https://github.com/llvm/llvm-project/commit/cec33fc87c0c0094b0d627031ff756b2d1f905eb
DIFF: https://github.com/llvm/llvm-project/commit/cec33fc87c0c0094b0d627031ff756b2d1f905eb.diff

LOG: [lldb] Consider TAG_imported_declaration in DebugNamesIndex

In order to recognize namespace aliases as a namespace, the
DW_TAG_imported_declaration has to be taken into account. The name of these DIEs
is already included in all accelerator tables as of D143397.

Two of the three Index classes already handle this correctly:

1. ManualDWARFIndex (as of D143398)
2. AppleDWARFIndex works by default with D143397, since apple has a table
dedicated to namespaces.

This commit updates the third index class, DWARF 5's DebugNamesDWARFIndex.
As a result, it fixes the following test with DWARF 5:
commands/expression/namespace-alias/TestInlineNamespaceAlias.py

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

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index 1711a229443672..af2d6c554140bc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -227,7 +227,9 @@ void DebugNamesDWARFIndex::GetNamespaces(
     ConstString name, llvm::function_ref<bool(DWARFDIE die)> callback) {
   for (const DebugNames::Entry &entry :
        m_debug_names_up->equal_range(name.GetStringRef())) {
-    if (entry.tag() == DW_TAG_namespace) {
+    dwarf::Tag entry_tag = entry.tag();
+    if (entry_tag == DW_TAG_namespace ||
+        entry_tag == DW_TAG_imported_declaration) {
       if (!ProcessEntry(entry, callback))
         return;
     }


        


More information about the lldb-commits mailing list