Instead of iterating over our vector of functions, we might as well use a map here to
directly get the function we need.
Thanks to Vedant for pointing this out.
Differential D50225
Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUID Authored by teemperor on Aug 2 2018, 10:47 PM.
Details
Instead of iterating over our vector of functions, we might as well use a map here to Thanks to Vedant for pointing this out.
Diff Detail Event TimelineComment Actions Thanks for doing this :)!
Comment Actions
| ||||||||
Is m_functions used to do anything crucial?
I see a use in Dump, but it seems like you could replace that use by copying the function map into a vector and sorting it. I see another use in GetFunctionAtIndex, but that API can be deleted entirely because its only user is lldb-test (via Module::ParseAllDebugSymbols). You'd just need to sink this block of code into CompileUnit:
for (size_t func_idx = 0; (sc.function = sc.comp_unit->GetFunctionAtIndex(func_idx).get()) != nullptr; ++func_idx) { symbols->ParseFunctionBlocks(sc); // Parse the variables for this function and all its blocks symbols->ParseVariablesForContext(sc); }