https://gcc.gnu.org/g:6071d580e71b160605130e1ebc2f5d2c2fec5172
commit r16-6885-g6071d580e71b160605130e1ebc2f5d2c2fec5172 Author: Marek Polacek <[email protected]> Date: Fri Jan 16 16:26:09 2026 -0500 c++: rename direct_base_parent to direct_base_derived During Reflection review Jason wanted this function renamed. gcc/cp/ChangeLog: * cp-tree.h (direct_base_parent): Rename to... (direct_base_derived): ...this. * decl2.cc (min_vis_expr_r): Call direct_base_derived instead of direct_base_parent. * pt.cc (iterative_hash_template_arg): Likewise. * reflect.cc (direct_base_parent_binfo): Rename to... (direct_base_derived_binfo): ...this. (direct_base_parent): Rename to... (direct_base_derived): ...this. (eval_is_expected_access): Call direct_base_derived_binfo instead of direct_base_parent_binfo. (eval_source_location_of): Call direct_base_derived instead of direct_base_parent. (eval_parent_of): Likewise. (eval_offset_of): Likewise. (eval_display_string_of): Likewise. (eval_annotations_of): Call direct_base_derived_binfo instead of direct_base_parent_binfo. (eval_is_accessible): Call direct_base_derived instead of direct_base_parent. Reviewed-by: Jason Merrill <[email protected]> Diff: --- gcc/cp/cp-tree.h | 2 +- gcc/cp/decl2.cc | 2 +- gcc/cp/pt.cc | 2 +- gcc/cp/reflect.cc | 20 ++++++++++---------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index d7acfc8b7a33..cef8a8e5c196 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -9334,7 +9334,7 @@ extern void coro_set_ramp_function (tree, tree); /* In reflect.cc */ extern void init_reflection (); extern bool metafunction_p (tree) ATTRIBUTE_PURE; -extern tree direct_base_parent (tree) ATTRIBUTE_PURE; +extern tree direct_base_derived (tree) ATTRIBUTE_PURE; extern tree process_metafunction (const constexpr_ctx *, tree, tree, bool *, bool *, tree *); extern tree get_reflection (location_t, tree, reflect_kind = REFLECT_UNDEF); diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 4de6345135f8..6dbfdeada205 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -3140,7 +3140,7 @@ min_vis_expr_r (tree *tp, int *walk_subtrees, void *data) tpvis = type_visibility (BINFO_TYPE (r)); if (tpvis > *vis_p) *vis_p = tpvis; - tpvis = type_visibility (direct_base_parent (r)); + tpvis = type_visibility (direct_base_derived (r)); *walk_subtrees = 0; break; case REFLECT_DATA_MEMBER_SPEC: diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 3c9ba31b212d..4906de000e66 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -1922,7 +1922,7 @@ iterative_hash_template_arg (tree arg, hashval_t val) { tree binfo = REFLECT_EXPR_HANDLE (arg); val = iterative_hash_template_arg (BINFO_TYPE (binfo), val); - val = iterative_hash_template_arg (direct_base_parent (binfo), val); + val = iterative_hash_template_arg (direct_base_derived (binfo), val); return val; } /* Now hash operands as usual. */ diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index 9e2eeab05bc7..c2cc6948798a 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -1309,7 +1309,7 @@ eval_is_class_member (tree r) to the derived type. */ static tree -direct_base_parent_binfo (tree r) +direct_base_derived_binfo (tree r) { /* Looping needed for multiple virtual inheritance. */ while (BINFO_INHERITANCE_CHAIN (r)) @@ -1321,9 +1321,9 @@ direct_base_parent_binfo (tree r) (i.e. when R is (D, B) it returns D). */ tree -direct_base_parent (tree r) +direct_base_derived (tree r) { - return BINFO_TYPE (direct_base_parent_binfo (r)); + return BINFO_TYPE (direct_base_derived_binfo (r)); } /* Helper function for eval_is_{public, protected, private}. */ @@ -1361,7 +1361,7 @@ eval_is_expected_access (tree r, reflect_kind kind, tree expected_access) if (kind == REFLECT_BASE) { gcc_assert (TREE_CODE (r) == TREE_BINFO); - tree c = direct_base_parent_binfo (r); + tree c = direct_base_derived_binfo (r); tree base_binfo; for (unsigned ix = 0; BINFO_BASE_ITERATE (c, ix, base_binfo); ix++) @@ -2534,7 +2534,7 @@ eval_source_location_of (location_t loc, tree r, reflect_kind kind, /* We don't track location_t of the base specifiers, so at least for now use location_t of the base parent (i.e. the derived class). */ - r = direct_base_parent (r); + r = direct_base_derived (r); if (OVERLOAD_TYPE_P (r) || (TYPE_P (r) && typedef_variant_p (r))) rloc = DECL_SOURCE_LOCATION (TYPE_NAME (r)); else if (DECL_P (r) && r != global_namespace) @@ -2939,7 +2939,7 @@ eval_parent_of (location_t loc, const constexpr_ctx *ctx, tree r, c = CP_TYPE_CONTEXT (r); } else if (kind == REFLECT_BASE) - c = direct_base_parent (r); + c = direct_base_derived (r); else c = CP_DECL_CONTEXT (r); tree lam; @@ -3087,7 +3087,7 @@ eval_offset_of (location_t loc, const constexpr_ctx *ctx, tree r, tree byte_off = NULL_TREE, bit_off = NULL_TREE; if (kind == REFLECT_BASE) { - tree d = direct_base_parent (r); + tree d = direct_base_derived (r); if (BINFO_VIRTUAL_P (r) && ABSTRACT_CLASS_TYPE_P (d)) return throw_exception (loc, ctx, "reflection of virtual direct base " @@ -3603,7 +3603,7 @@ eval_display_string_of (location_t loc, const constexpr_ctx *ctx, tree r, pp_printf (&pp, "%T::<unnamed bit-field>", DECL_CONTEXT (r)); else if (kind == REFLECT_BASE) { - tree d = direct_base_parent (r); + tree d = direct_base_derived (r); pp_printf (&pp, "%T: %T", d, BINFO_TYPE (r)); } else if (kind == REFLECT_DATA_MEMBER_SPEC) @@ -3781,7 +3781,7 @@ eval_annotations_of (location_t loc, const constexpr_ctx *ctx, tree r, if (kind == REFLECT_BASE) { gcc_assert (TREE_CODE (r) == TREE_BINFO); - tree c = direct_base_parent_binfo (r), binfo = r, base_binfo; + tree c = direct_base_derived_binfo (r), binfo = r, base_binfo; r = NULL_TREE; for (unsigned ix = 0; BINFO_BASE_ITERATE (c, ix, base_binfo); ix++) @@ -6350,7 +6350,7 @@ eval_is_accessible (location_t loc, const constexpr_ctx *ctx, tree r, } else if (kind == REFLECT_BASE) { - c = direct_base_parent (r); + c = direct_base_derived (r); r = BINFO_TYPE (r); } else
