[Lldb-commits] [PATCH] D128366: [lldb] Make Module::LookupInfo::Prune language-agnostic

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 24 10:54:51 PDT 2022


bulbazord added a comment.

In D128366#3608051 <https://reviews.llvm.org/D128366#3608051>, @labath wrote:

> In D128366#3605484 <https://reviews.llvm.org/D128366#3605484>, @bulbazord wrote:
>
>> In D128366#3603943 <https://reviews.llvm.org/D128366#3603943>, @labath wrote:
>>
>>> Could we move this pruning elsewhere? These values come from the symbol file plugins anyway, and they can do a better job at determining which language does a particular name belong to.
>>> (OK, they can an also come from the symtab, but there I guess we could infer something from the mangling scheme).
>>
>> We're specifically pruning the results from a name lookup, so I'm not sure where would be a better place to move it.
>
> Well. I guess ideally I would pass whatever information is needed into the lookup functions themselves, so that there is no need for the additional filtering. I don't know why it's done this way but this setup seems inefficient, as we have to generate all these SymbolContext only for them to be (potentially) thrown away...

I see what you mean now. I'll look at this instead, maybe we can get rid of `LookupInfo::Prune` altogether. :)



================
Comment at: lldb/include/lldb/Target/Language.h:320
+  virtual bool NamesAreEquivalentWithContext(
+      const ConstString &user_provided_name,
+      const ConstString &full_name_with_context) const {
----------------
labath wrote:
> bulbazord wrote:
> > labath wrote:
> > > I think we're passing ConstStrings by value these days...
> > I see. Is there a reason we do that instead of passing by reference?
> ConstString is just a fancy wrapper around a const char *, so adding a layer of indirection does not really save us anything (in fact, it's the opposite).
Ah, this makes sense. I should have looked at ConstString more closely. Thank you! :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128366



More information about the lldb-commits mailing list