[Lldb-commits] [PATCH] D53662: Give the SymbolFile plugin enough information to efficiently do exact match lookups

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 26 09:25:17 PDT 2018

clayborg added a comment.

My issue with adding "exact_match" is it renders a few of the arguments useless:

  size_t FindTypes(
    const SymbolContext &sc, 
    llvm::StringRef name,
    const CompilerDeclContext *parent_decl_ctx, 
    bool exact_match,

With exact_match "parent_decl_ctx" is useless and possible the symbol context too. The FindTypes as written today was used for two cases which evolved over time:

- finding types for users without needing to be fully qualified
- finding types for the expression parser in a specific context

To fulfill these two cases, arguments have been added over time. As we keep adding arguments we make the function even harder to implement for SymbolFile subclasses. So as long as we are cleaning things up, it might be time to factor this out by making changes now.

Another complexity is that we can either search a single module or multiple modules when doing searches, and that is why we have Module::FindTypes_Impl(...) in since there is some work that needs to be done when we are searching by basename only (strip the context and search by basename, then filters matches afterward.

That is why I was thinking we might want to make changes. Seems like having:

  size_t FindTypesByBasename(
    const SymbolContext &sc, 
    llvm::StringRef name,
    const CompilerDeclContext *parent_decl_ctx
  size_t FindTypesByFullname(llvm::StringRef name, ...);

Clients of the first call must strip a typename to its identifier name prior to calling, and clients of the second can call with a fully qualified typename.


More information about the lldb-commits mailing list