diff options
| -rw-r--r-- | libdw/c++/dwarf_output | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/libdw/c++/dwarf_output b/libdw/c++/dwarf_output index 03d89265..b6452917 100644 --- a/libdw/c++/dwarf_output +++ b/libdw/c++/dwarf_output @@ -246,12 +246,17 @@ namespace elfutils typedef std::vector<die_info_pair *> _base; size_t _m_hash; + size_t _m_local_hash; inline void set_hash () { _m_hash = 0; + _m_local_hash = 0; for (_base::iterator i = _base::begin (); i != _base::end (); ++i) - subr::hash_combine (_m_hash, (uintptr_t) *i); + { + subr::hash_combine (_m_hash, (uintptr_t) *i); + subr::hash_combine (_m_local_hash, (*i)->first.local_hash ()); + } } inline children_type () {} @@ -293,6 +298,7 @@ namespace elfutils inline bool is (const children_type &these) const { return (_m_hash == these._m_hash + && _m_local_hash == these._m_local_hash && size () == these.size () && std::equal (_base::begin (), _base::end (), these._base::begin ())); @@ -311,6 +317,11 @@ namespace elfutils { return const_iterator (_base::end (), subr::nothing ()); } + + inline size_t local_hash () const + { + return _m_local_hash; + } }; typedef children_type::iterator pointer; @@ -418,7 +429,7 @@ namespace elfutils { size_t hash = _m_tag; subr::hash_combine (hash, _m_attributes->local_hash ()); - subr::hash_combine (hash, _m_children->size ()); + subr::hash_combine (hash, _m_children->local_hash ()); return hash; } }; @@ -1499,7 +1510,15 @@ namespace elfutils attr_hash ^= (it->first << 3); } subr::hash_combine (hash, attr_hash); - subr::hash_combine (hash, _m_children.size ()); + + size_t children_hash = 0; + for (typename std::vector<entry *>::const_iterator it + = _m_children.begin (); + it != _m_children.end (); + ++it) + subr::hash_combine (children_hash, (*it)->local_hash ()); + subr::hash_combine (hash, children_hash); + return hash; } }; |
