]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Add local hash for children_types.
authorMark Wielaard <mjw@redhat.com>
Fri, 21 Jan 2011 21:44:15 +0000 (22:44 +0100)
committerMark Wielaard <mjw@redhat.com>
Fri, 21 Jan 2011 23:45:06 +0000 (00:45 +0100)
libdw/c++/dwarf_output

index 2c68cbe276e406b418e43b5d56d4f1c36b54f33b..04ace9646af95653c7521d885be10518728ad091 100644 (file)
@@ -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;
       }
     };