[Lldb-commits] [lldb] Remove redundant symbol lookups in IRExecutionUnit::FindInSymbols (PR #102835)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Mon Aug 12 12:57:01 PDT 2024
https://github.com/clayborg commented:
While this does solve the problem, it means other clients that want to do the same thing will need to create this same kind of code.
I would propose we modify `ModuleList::FindSymbolsWithNameAndType(...)` to take an extra parameter `SymbolContext &sc` which indicates the contents from which we are doing the search:
```
void ModuleList::FindSymbolsWithNameAndType(
ConstString name,
lldb::SymbolType symbol_type,
const SymbolContext &sc, /// <-- The symbol context from which to perform the lookup
SymbolContextList &sc_list) const;
```
Then the code inside will check if "sc" has a module, and if so, prefer that module first since someone is performing the search from somewhere (like an expression has a symbol context of the location in the current stack frame).
Then we don't duplicate this kind of code everywhere.
We need these `SymbolContext &sc` in a lot of searches:
- search for types for an expression so we can prefer types from the current function, then compile unit, then module, and all modules.
- search for functions, for same reason
-
https://github.com/llvm/llvm-project/pull/102835
More information about the lldb-commits
mailing list