@@ -2203,15 +2203,26 @@ register_odr_type (tree type)
}
}
+/* Return true if the type represented by OT is known to have no
+ derivations. */
+
+static bool
+odr_type_known_to_have_no_derivations_p (odr_type ot)
+{
+ return (ot->all_derivations_known
+ && ot->derived_types.is_empty ());
+}
+
/* Return true if type is known to have no derivations. */
bool
type_known_to_have_no_derivations_p (tree t)
{
- return (type_all_derivations_known_p (t)
- && (TYPE_FINAL_P (t)
- || (odr_hash
- && !get_odr_type (t, true)->derived_types.length())));
+ if (TYPE_FINAL_P (t))
+ return true;
+ if (!odr_hash)
+ return false;
+ return odr_type_known_to_have_no_derivations_p (get_odr_type (t, true));
}
/* Dump ODR type T and all its derived types. INDENT specifies indentation for
@@ -2721,7 +2732,7 @@ possible_polymorphic_call_targets_1 (vec <cgraph_node *> &nodes,
{
record_target_from_binfo (nodes,
(!possibly_instantiated
- && type_all_derivations_known_p (type->type))
+ && type->all_derivations_known)
? &bases_to_consider : NULL,
binfo, otr_type, type_binfos, otr_token,
outer_type, offset,
@@ -3183,7 +3194,7 @@ possible_polymorphic_call_targets (tree otr_type,
/* We need to update our hierarchy if the type does not exist. */
outer_type = get_odr_type (context.outer_type, true);
/* If the type is complete, there are no derivations. */
- if (TYPE_FINAL_P (outer_type->type))
+ if (odr_type_known_to_have_no_derivations_p (outer_type))
context.maybe_derived_type = false;
/* Initialize query cache. */
@@ -3272,7 +3283,7 @@ possible_polymorphic_call_targets (tree otr_type,
/* First insert target from type itself and check if it may have
derived types. */
speculative_outer_type = get_odr_type (context.speculative_outer_type, true);
- if (TYPE_FINAL_P (speculative_outer_type->type))
+ if (odr_type_known_to_have_no_derivations_p (speculative_outer_type))
context.speculative_maybe_derived_type = false;
binfo = get_binfo_at_offset (TYPE_BINFO (speculative_outer_type->type),
context.speculative_offset, otr_type);
@@ -3427,7 +3438,7 @@ possible_polymorphic_call_targets (tree otr_type,
if (type != outer_type
&& (!skipped
|| (context.maybe_derived_type
- && !type_all_derivations_known_p (outer_type->type))))
+ && !outer_type->all_derivations_known)))
record_targets_from_bases (otr_type, otr_token, outer_type->type,
context.offset, nodes, &inserted,
&matched_vtables, &complete);