labath added a comment.

In D94077#2489064 <https://reviews.llvm.org/D94077#2489064>, @werat wrote:

> Thanks for the explanation, this makes sense. I've checked the mailing list 
> archives and it seems there was already a discussion about the enumerators in 
> the `.debug_names` index back in 2018 -- 
> http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2018-April/004443.html.
>  You were the one to bring it up and the consensus was that the enumerators 
> should go into the index too.
>
> But it seems this was never actually implemented, the latest version of the 
> toolchain doesn't add `DW_TAG_enumerator` entries to the `.debug_names` 
> index. Is there a reason for that or it just slipped through the cracks? 
> Should I bring it up again on the mailing list or we can assume the consensus 
> is still the same and this should be just implemented?

As I recall, I myself started having doubts about the correctness of that 
approach, as I started discovering other interesting named objects that were 
not in the index:

- using bar = foo; // another name for foo
- using foo = bar::foo; // same name but in a different namespace
- using namespace foo; // another name for _everything_ in foo

I started being unsure where should the line be drawn, and (coupled with 
insufficient time to investigate this in depth) decided to stick to what the 
spec says. I am also unsure whether that discussion would be sufficiently 
authoritative to decide on the matter, since this is pretty clearly in 
contradiction with the wording of the spec.  And there's still the question of 
how much extra space will this feature consume (there's no way to "home" these 
declarations, so they index entries would have to be emitted for each compile 
unit that uses them)...

> Regarding the changes in the manual index. Do you think there's a better way 
> to implement enumerators lookup?

Maybe? It depends on what kinds of contexts we'd want these enumerators to be 
recognised. If we're fine with seeing just the enumerators visible in the 
current scope, then we could parse the current compile unit, looking for enum 
declarations -- I believe "using namespace" declarations are handled in this 
way. If we'd want them to be visible globally, then things get trickier. Though 
there's always the possibility to say that the feature is not worth the cost it 
brings...

> Assuming `.debug_names` and `apple_names` are updated to include the 
> enumerators, `manual_index` should be updated as well to match the behaviour.

Yep, that much we can agree on. :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94077

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to