From a9f08da3c98904088299687bf47633f500896595 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Fri, 28 Aug 2015 19:34:51 +0200 Subject: [PATCH] Fix important hashing issues * 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 --- src/abg-hash.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/abg-hash.cc b/src/abg-hash.cc index 8823cd08..a9a645e4 100644 --- a/src/abg-hash.cc +++ b/src/abg-hash.cc @@ -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 = -- 2.43.5