Do not overly canonicalize types during typedef stripping

strip_typedef() canonicalizes the stripped typed, even if the input
type was not canonicalized.  This can lead to early canonicalization
that is not warranted.  For instance, is_compatible_with_class_type()
calls strip_typedef() and can be called during DWARF reading on types
that haven't been canonicalized yet; this was triggering a
canonicalization what was happening too early.

With this patch, strip_typedef() does not canonicalize a stripped type
if the input type wasn't itself canonicalized.

	* src/abg-ir.cc (strip_typedef): Do not canonicalize the stripped
	type if the input one is not canonicalized.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-10-02 17:59:52 +02:00
parent 38e17e0e07
commit d208e0e6c2

View File

@ -3107,7 +3107,7 @@ strip_typedef(const type_base_sptr type)
if (!t->get_environment())
set_environment_for_artifact(t, env);
if (!canonicalize(t))
if (!(type->get_canonical_type() && canonicalize(t)))
keep_type_alive(t);
return t->get_canonical_type() ? t->get_canonical_type() : t;