[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 13 09:33:57 PDT 2024


Michael137 wrote:

> Oh, wait a sec. I actually changed the behavior of the `IRExecutionUnit::FindInSymbols`. It used to exit early if the function was found in `module_sp`, but now we will always scan through the whole ModuleList. And we can't change the behavior of the `ModuleList::FindFunctions` to return after the first match, because it might be not what we want in general case. Maybe I should add more generic versions of these functions taking a callback to invoke on each match instead of SymbolContextList? Something like
> 
> ```
> void ModuleList::FindSymbolsWithNameAndType(
>   ConstString name,
>   lldb::SymbolType symbol_type,
>   const SymbolContext *search_hint,
>   llvm::function_ref<bool(const Symbol&)> callback
>   )
> ```
> 
> where the result of `callback` indicates whether the search should be continued or not.

Can we make it configurable behind the `ModuleSearchOptions`? This is what the `FindTypes` API does via `TypeQuery` (which has a bunch of flags to configure your search, including `eFindOne`, etc.). There's already a `ModuleFunctionSearchOptions` that could be re-used for this?

https://github.com/llvm/llvm-project/pull/102835


More information about the lldb-commits mailing list