[Lldb-commits] [PATCH] D154730: [lldb] Consider TAG_imported_declaration in DebugNamesIndex

Felipe de Azevedo Piovezan via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 7 10:58:37 PDT 2023


fdeazeve created this revision.
Herald added a subscriber: arphaman.
Herald added a project: All.
fdeazeve requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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 <https://reviews.llvm.org/D143397>.

Two of the three Index classes already handle this correctly:

1. ManualDWARFIndex (as of D143398 <https://reviews.llvm.org/D143398>)
2. AppleDWARFIndex works by default with D143397 <https://reviews.llvm.org/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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154730

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


Index: lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -227,7 +227,9 @@
     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;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154730.538206.patch
Type: text/x-patch
Size: 713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230707/a00ce39e/attachment.bin>


More information about the lldb-commits mailing list