[Lldb-commits] [PATCH] D50225: Use a DenseMap for looking up functions by UID in CompileUnit::FindFunctionByUID

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 3 10:53:27 PDT 2018


vsk added a comment.

Thanks for doing this :)!



================
Comment at: source/Symbol/CompileUnit.cpp:111
   // TODO: order these by address
   m_functions.push_back(funcSP);
 }
----------------
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);
      }
```


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D50225





More information about the lldb-commits mailing list