From: Dodji Seketeli Date: Wed, 4 Jan 2017 22:54:16 +0000 (+0100) Subject: Cleanup ODR-based type canonicalization optimization gating logic X-Git-Tag: upstream/1.0~178 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf62a050c7a5b764d9c710aab6b987b8b04b5563;p=platform%2Fupstream%2Flibabigail.git 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 --- diff --git a/src/abg-ir.cc b/src/abg-ir.cc index 9fa993ad..b9327814 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -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())