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.
Paths
| Differential D50225
Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUID ClosedPublic Authored by teemperor on Aug 2 2018, 10:47 PM.
Details
Summary 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
This revision is now accepted and ready to land.Aug 10 2018, 5:08 PM Closed by commit rL339504: Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUID (authored by teemperor). · Explain WhyAug 11 2018, 4:41 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 160245 include/lldb/Symbol/CompileUnit.h
source/Core/Module.cpp
source/Symbol/CompileUnit.cpp
|
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: