Avoid unnecessary updates to type lookup maps

In class_or_union::set_is_declaration_only we should update the type
lookup maps only when a class type that was previously a
declaration-only type is now a defined type.  Otherwise, updating the type
lookup maps is unnecessary and profiling shows that it takes a
significant amount of time.

This patch does away with the unnecessary attempts to update type
lookup maps.

	* src/abg-ir.cc (class_or_union::get_is_declaration_only): Try
          to update the type maps only when a declaration-only class
          type is now defined.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2017-01-05 00:50:34 +01:00
parent 7c004d6922
commit b8452d2d59

View File

@ -14669,15 +14669,18 @@ class_or_union::get_is_declaration_only() const
void
class_or_union::set_is_declaration_only(bool f)
{
bool update_types_lookup_map = !f && priv_->is_declaration_only_;
priv_->is_declaration_only_ = f;
if (!f)
if (update_types_lookup_map)
if (scope_decl* s = get_scope())
{
declarations::iterator i;
if (s->find_iterator_for_member(this, i))
maybe_update_types_lookup_map(*i);
else
abort();
ABG_ASSERT_NOT_REACHED;
}
}