return build_bases;
}
-/* REF is OBJ_TYPE_REF, return the class the ref corresponds to. */
+/* REF is OBJ_TYPE_REF, return the class the ref corresponds to.
+ FOR_DUMP_P is true when being called from the dump routines. */
tree
-obj_type_ref_class (const_tree ref)
+obj_type_ref_class (const_tree ref, bool for_dump_p)
{
gcc_checking_assert (TREE_CODE (ref) == OBJ_TYPE_REF);
ref = TREE_TYPE (ref);
tree ret = TREE_TYPE (ref);
if (!in_lto_p && !TYPE_STRUCTURAL_EQUALITY_P (ret))
ret = TYPE_CANONICAL (ret);
+ else if (odr_type ot = get_odr_type (ret, !for_dump_p))
+ ret = ot->type;
else
- ret = get_odr_type (ret)->type;
+ gcc_assert (for_dump_p);
return ret;
}
--- /dev/null
+template<typename T> struct foo { virtual void f() = 0; };
+extern foo<__Int8x8_t> &x;
+void f() { x.f(); }
libstdc++-prettyprinters/shared_ptr.cc with and without -g,
for example, at occurrences of OBJ_TYPE_REF. */
if (!(flags & (TDF_SLIM | TDF_COMPARE_DEBUG))
- && virtual_method_call_p (node))
+ && virtual_method_call_p (node, true))
{
pp_string (pp, "(");
- dump_generic_node (pp, obj_type_ref_class (node), spc, flags, false);
+ dump_generic_node (pp, obj_type_ref_class (node, true),
+ spc, flags, false);
pp_string (pp, ")");
}
dump_generic_node (pp, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
OBJ_TYPE_REF representing an virtual call of C++ method.
(As opposed to OBJ_TYPE_REF representing objc calls
through a cast where middle-end devirtualization machinery
- can't apply.) */
+ can't apply.) FOR_DUMP_P is true when being called from
+ the dump routines. */
bool
-virtual_method_call_p (const_tree target)
+virtual_method_call_p (const_tree target, bool for_dump_p)
{
if (TREE_CODE (target) != OBJ_TYPE_REF)
return false;
/* If we do not have BINFO associated, it means that type was built
without devirtualization enabled. Do not consider this a virtual
call. */
- if (!TYPE_BINFO (obj_type_ref_class (target)))
+ if (!TYPE_BINFO (obj_type_ref_class (target, for_dump_p)))
return false;
return true;
}
extern location_t tree_nonartificial_location (tree);
extern tree block_ultimate_origin (const_tree);
extern tree get_binfo_at_offset (tree, poly_int64, tree);
-extern bool virtual_method_call_p (const_tree);
-extern tree obj_type_ref_class (const_tree ref);
+extern bool virtual_method_call_p (const_tree, bool = false);
+extern tree obj_type_ref_class (const_tree ref, bool = false);
extern bool types_same_for_odr (const_tree type1, const_tree type2);
extern bool contains_bitfld_component_ref_p (const_tree);
extern bool block_may_fallthru (const_tree);