Page MenuHomePhabricator

[DWARF] Centralize user_id <-> DWARFDIE conversions

Authored by labath on May 7 2019, 12:31 PM.



The logic for translating a user_id into a DWARFDIE was replicated in
several places. This removes that redundancy and settles on a single
implementation in SymbolFileDWARF.

The reason for choosing that instead of DIERef was that we were
always immediately converting the returned DIERef into a DWARFDIE
anyway, which meant that one had to specify the SymbolFileDWARF argument
twice (once to get the DIERef, and once to get the actual DIE). Also,
passing a higher-level object (SymbolFileDWARF) into a lower-level one
(DIERef) seemed like a less intuitive arrangement than doing things the
other way around.

Diff Detail


Event Timeline

labath created this revision.May 7 2019, 12:31 PM
clayborg added inline comments.May 7 2019, 1:53 PM
137 ↗(On Diff #198510)

Maybe just overload?:

DWARFDIE GetDIE(lldb::user_id_t uid);
138–139 ↗(On Diff #198510)

Maybe just overload these?:

lldb::user_id_t GetUID(DWARFBaseDIE die);
lldb::user_id_t GetUID(DIERef ref);
JDevlieghere accepted this revision.May 7 2019, 6:31 PM

Greg's suggestion for an overload seems reasonable. Otherwise LGTM.

This revision is now accepted and ready to land.May 7 2019, 6:31 PM
labath marked 3 inline comments as done.May 8 2019, 4:40 AM
labath added inline comments.
138–139 ↗(On Diff #198510)

Sounds good.

This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2019, 4:41 AM