[PATCH] D143397: [WIP][llvm][DebugInfo] Add DW_TAG_imported_declaration to accelerator tables

Michael Buch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 6 09:18:08 PST 2023


Michael137 added a comment.

In D143397#4107079 <https://reviews.llvm.org/D143397#4107079>, @dblaikie wrote:

> It'd be good if this issue were submitted to the DWARF committee as a fix for the .debug_names accelerator tables.
>
> I don't /think/ you need unnamed entries in the index - since these entries are only for finding named entities by unqualified name, so an unnamed using namespace doesn't introduce any new unqualified names?
>
> I guess if the user writes "x::y" (and the code has "z::y" defined and "using namespace z" in namespace x) then you need some breadcrumb that when you do unqualified lookup for "y" and unqualified lookup for "x" you can see that they're connected/actually would resolve to that name? How does this work currently for "z::y"? You do lookup for "y" then check its parent DIE and see that it's "z" and so it satisfies the lookup?



> I don't /think/ you need unnamed entries in the index - since these entries are only for finding named entities by unqualified name, so an unnamed using namespace doesn't introduce any new unqualified names?

Actually I'm not quite sure how we can get empty import declarations (since `using namespace Foo` is represented by `DW_TAG_imported_module`)

> I guess if the user writes "x::y" (and the code has "z::y" defined and "using namespace z" in namespace x) then you need some breadcrumb that when you do unqualified lookup for "y" and unqualified lookup for "x" you can see that they're connected/actually would resolve to that name?

Good point, currently this isn't supported. And this patch wouldn't help with that. To support `x::y` in LLDB we'd have to add the `DW_TAG_imported_module` into the accelerator table too, under the name of the module it's importing (?) Though I'd be fine with not adding support for this for now

> How does this work currently for "z::y"? You do lookup for "y" then check its parent DIE and see that it's "z" and so it satisfies the lookup?

The order of operations is:

1. Lookup `z`. Finds namespace
2. Lookup `y`. Finds namespace
3. Check that `y` "is contained in" `z` (accounts for inline namespaces between the two)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143397/new/

https://reviews.llvm.org/D143397



More information about the llvm-commits mailing list