Page MenuHomePhabricator

Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUID

Authored by teemperor on Aug 2 2018, 10:47 PM.


Diff Detail


Event Timeline

teemperor created this revision.Aug 2 2018, 10:47 PM
vsk added a comment.Aug 3 2018, 10:53 AM

Thanks for doing this :)!

111 ↗(On Diff #158876)

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()) !=
     ++func_idx) {

  // Parse the variables for this function and all its blocks
teemperor updated this revision to Diff 160214.Aug 10 2018, 5:06 PM
  • Replaced m_functions and instead copy the map to a temporary sorted vector and iterate over that.
vsk accepted this revision.Aug 10 2018, 5:08 PM

Thanks, LGTM!

This revision is now accepted and ready to land.Aug 10 2018, 5:08 PM
teemperor updated this revision to Diff 160245.Aug 11 2018, 4:40 PM
  • Passing shared_ptr to lambda now as const-ref.
This revision was automatically updated to reflect the committed changes.