diff options
author | Mark Wielaard <[email protected]> | 2011-02-18 11:03:52 +0100 |
---|---|---|
committer | Mark Wielaard <[email protected]> | 2011-02-20 11:04:30 +0100 |
commit | 9f4f4ed9cba7a7e8d8b754955ebb709d2543ea16 (patch) | |
tree | 53a06f03b1cd68f48e1c7ccd62770157a1432fdc | |
parent | ebf8e9f5c7789813ab4ed5e8969e8353eb32331f (diff) |
Add get_die_info to references, use for hash calculation.
-rw-r--r-- | libdw/c++/dwarf_output | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/libdw/c++/dwarf_output b/libdw/c++/dwarf_output index d60bb977..de63785d 100644 --- a/libdw/c++/dwarf_output +++ b/libdw/c++/dwarf_output @@ -393,14 +393,6 @@ namespace elfutils { return 0; } - - /* The hash as used for a reference attribute value that points - to this die. Only uses "local" (non-reference) values. - Result cached in die_info. */ - inline size_t local_hash () const - { - return info ()->second._m_local_hash; - } }; struct value::value_reference @@ -420,9 +412,15 @@ namespace elfutils /* The hash of a value_reference is its referent's local hash, which only takes non-reference values into account. This method is virtual for the circular_reference case, below. */ - virtual size_t hash () const + inline size_t hash () const + { + struct die_info *info = get_die_info (); + return info->_m_local_hash; + } + + virtual die_info *get_die_info () const { - return ref->local_hash (); + return &ref->info ()->second; } }; @@ -602,7 +600,8 @@ namespace elfutils inline die_info (size_t local_hash) : _m_parent (NULL), _m_refs (), _m_originals (), _m_original_cost (0), - _m_with_sibling (), _m_uses (0), _m_local_hash (local_hash) + _m_with_sibling (), _m_uses (0), + _m_local_hash (local_hash) {} inline ~die_info () @@ -1246,9 +1245,9 @@ namespace elfutils /* We have a special case for a reference attribute that is part of a circular chain. It gets calculated from the pending_entry. */ - virtual size_t hash () const + virtual die_info *get_die_info () const { - return pending_entry ()->local_hash (); + return pending_entry ()->get_die_info (); } }; @@ -1816,11 +1815,11 @@ namespace elfutils /* The local hash of the debug_info_entry if we are already final, otherwise get it from the pending_entry. */ - inline size_t local_hash () const + inline die_info *get_die_info () const { if (_m_final) - return _m_final->first.local_hash (); - return _m_pending->_m_info->_m_local_hash; + return &_m_final->second; + return _m_pending->_m_info; } }; |