Cleanup ODR-based type canonicalization optimization gating logic

During type canonicalization we use an ODR-based optimization which
consists of saying that if two types of the same kind have the same
name and are defined in the same ABI corpus, then they are the same
type -- whithout needing to actually perform a structural comparison
of both types.  This speeds up type canonicalization greatly for types
that are duplicated in the ABI corpus.

The condition to apply that ODR-based optimization is basically that
the binary we are looking at must be in C++.

This patch just makes that condition clearer.

	* src/abg-ir.cc (type_base::get_canonical_type_for): Make it clear
	that the ODR-based optimization is allowed only on C++ ABI
	corpora.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2017-01-04 23:54:16 +01:00
parent 6734da6a04
commit bf62a050c7

View File

@ -9030,12 +9030,11 @@ type_base::get_canonical_type_for(type_base_sptr t)
translation_unit::language other_lang =
(*it)->get_translation_unit()->get_language();
bool is_odr_allowed =
is_cplus_plus_language(lang) && is_cplus_plus_language(other_lang);
if (t_corpus
&& ((is_c_language(lang) || is_cplus_plus_language(lang))
&& (is_c_language(other_lang)
|| is_cplus_plus_language(other_lang)))
// We are doing the ODR-based optimization just for
// non-anonymous user-defined types, and built-in types
&& is_odr_allowed
&& type_eligible_for_odr_based_comparison(t))
{
if (const corpus* it_corpus = (*it)->get_corpus())