This is an archive of the discontinued LLVM Phabricator instance.

DWARF: Provide accessors to DIERef fields
ClosedPublic

Authored by labath on Jun 17 2019, 2:09 AM.

Details

Summary

Instead of accessing the fields directly, use accessor functions to
provide access to the DIERef components. This allows us to decouple the
external interface, from the internal representation. The external
interface can use llvm::Optional and similar goodies, while the data can
still be stored internally in a more compact representation.

I also document the purpose of the existing DIERef fields.

The main motivation for this change is a need to introduce an additional
field to the DIERef class, but I believe the change has its own merit.

Event Timeline

labath created this revision.Jun 17 2019, 2:09 AM

(also, cu_offset is renamed to unit_offset, as we now support type units too)

labath updated this revision to Diff 205006.Jun 17 2019, 2:23 AM
  • s/DW_INVALID_OFFSET/llvm::None/ in HashedNameToDIE.h

Just questioning if we want to increase the size of the DIERef struct.

source/Plugins/SymbolFile/DWARF/DIERef.h
47–48

We we want this to be:

dw_offset_t m_section:1;
dw_offset_t m_unit_offset:31;

Otherwise we increase the size of the DIERef struct?

clayborg accepted this revision.Jun 17 2019, 8:01 AM
clayborg added inline comments.
source/Plugins/SymbolFile/DWARF/DIERef.h
48

Never mind, saw your other DWO related patch. Makes sense now.

This revision is now accepted and ready to land.Jun 17 2019, 8:01 AM
JDevlieghere accepted this revision.Jun 17 2019, 2:27 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2019, 1:23 AM