]> sourceware.org Git - libabigail.git/commitdiff
Fix important hashing issues
authorDodji Seketeli <dodji@redhat.com>
Fri, 28 Aug 2015 17:34:51 +0000 (19:34 +0200)
committerDodji Seketeli <dodji@redhat.com>
Sat, 29 Aug 2015 14:23:15 +0000 (16:23 +0200)
* src/abg-hash.cc (class_decl::hash::operator()): Do not force
base classes to have definitions anymore.  GCC and Clang (at
least) some time emits debug info in which the definition of some
base classes are missing, especially when those base classes have
vtables.  In that case, the definition of the class might it's in
the binary where the vtable is emitted, which might not be the
binary we are looking at.  So let's relax the assertion we had
here for base classes.  For hashing virtual member functions,
directly walk the virtual member functions by looking at
class_decl::get_virtual_mem_fns() rather than walking all
member functions and looking for the virtual ones.  This is a
speed optimization but it also helps during debugging.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-hash.cc

index 8823cd0872be53d9b51b896ae582522a91844c34..a9a645e4ad2658fd88cba5a805720e785b158a83 100644 (file)
@@ -636,9 +636,6 @@ class_decl::hash::operator()(const class_decl& t) const
        ++b)
     {
       class_decl_sptr cl = (*b)->get_base_class();
-      assert(cl
-            && (!cl->get_is_declaration_only()
-                || cl->get_definition_of_declaration()));
       v = hashing::combine_hashes(v, hash_base(**b));
     }
 
@@ -660,11 +657,13 @@ class_decl::hash::operator()(const class_decl& t) const
 
   // Hash virtual member_functions
   for (class_decl::member_functions::const_iterator f =
-        t.get_member_functions().begin();
-       f != t.get_member_functions().end();
+        t.get_virtual_mem_fns().begin();
+       f != t.get_virtual_mem_fns().end();
        ++f)
-    if (get_member_function_is_virtual(*f))
+    {
+      assert(get_member_function_is_virtual(*f));
       v = hashing::combine_hashes(v, hash_member_fn(**f));
+    }
 
   // Hash member function templates
   for (class_decl::member_function_templates::const_iterator f =
This page took 0.073174 seconds and 5 git commands to generate.