Fix important hashing issues

* src/abg-hash.cc (class_decl:#️⃣: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>
This commit is contained in:
Dodji Seketeli 2015-08-28 19:34:51 +02:00
parent fbba4bf0ed
commit a9f08da3c9

View File

@ -636,9 +636,6 @@ class_decl::hash::operator()(const class_decl& t) const
++b) ++b)
{ {
class_decl_sptr cl = (*b)->get_base_class(); 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)); 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 // Hash virtual member_functions
for (class_decl::member_functions::const_iterator f = for (class_decl::member_functions::const_iterator f =
t.get_member_functions().begin(); t.get_virtual_mem_fns().begin();
f != t.get_member_functions().end(); f != t.get_virtual_mem_fns().end();
++f) ++f)
if (get_member_function_is_virtual(*f)) {
assert(get_member_function_is_virtual(*f));
v = hashing::combine_hashes(v, hash_member_fn(**f)); v = hashing::combine_hashes(v, hash_member_fn(**f));
}
// Hash member function templates // Hash member function templates
for (class_decl::member_function_templates::const_iterator f = for (class_decl::member_function_templates::const_iterator f =