The various maps in Symtab lead to some repetative code. This should
improve the situation somewhat.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Only have some comments about the way FindFunctionSymbols is now implemented, but otherwise this LGTM.
lldb/include/lldb/Symbol/Symtab.h | ||
---|---|---|
177–180 | /// Maps function names to symbol indices (grouped by FunctionNameTypes) | |
lldb/source/Symbol/Symtab.cpp | ||
1038 | Those large maps seem rather expensive to copy around. Could you just make this a for loop over the few types we care about? Then we can delete all the duplicated code. for (lldb::FunctionNameType type : {lldb::eFunctionNameTypeBase, lldb::eFunctionNameTypeMethod, lldb::eFunctionNameTypeSelector}) { if (name_type_mask & type) { auto &map = GetFunctypeMap(type); [search map] } } |
Some small rename I forgot to point out, but LGTM modulo that rename. Thanks for cleaning this up!
lldb/include/lldb/Symbol/Symtab.h | ||
---|---|---|
186 | GetNameToSymbolIndexMap might be more accurate now (I should have pointed out when changing the variable name). |
/// Maps function names to symbol indices (grouped by FunctionNameTypes)
and maybe let's call this variable:
m_name_to_symbol_indizes