[Lldb-commits] [PATCH] D73206: Pass `CompileUnit *` along `DWARFDIE` for DWZ

Jan Kratochvil via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 30 04:50:24 PDT 2020

jankratochvil added a comment.

In D73206#1949516 <https://reviews.llvm.org/D73206#1949516>, @labath wrote:

> The main thing I don't like about the current state is the introduction of user_id_t into the index classes. It forces a bunch of conversions for a flow that really should be simple.
> I guess that was to avoid main-cu-ificating the DIERef class?

Yes, that was the purpose of D74637 <https://reviews.llvm.org/D74637>. To have two different small (8 bytes) DIE references, one with MainCU (chosen to be `user_id_t`) and one without MainCU (chosen to be `DIERef`).

> I think (and I think I've already said this) the right thing to do here would be to change the index classes to be callback-based. Then the memory footprint is out of the equation (no vector<DIERef>, and the indexes can return a "main cu pair" or something of sorts, as that is what their callers will convert this to anyway.

OK, I can make an unrelated trunk-based refactorization for `DWARFIndex` descendants to use callbacks.

Internally `ManualDWARFIndex` and `DebugNamesDWARFIndex` need to store also MainCU so `user_id_t` looks to me as their best choice for their internal storage. It is true `AppleDWARFIndex` does not need MainCU so that would prevent its `DIERef`->`user_id_t` conversion, that is the only win there I can see. One could also refactor `AppleDWARFIndex` even more to use `user_id_t` natively. Would then be there still a win with the callback?

Or is the callback preferred unrelated to any `DIERef` vs. `user_id_t`?

  rG LLVM Github Monorepo



More information about the lldb-commits mailing list