]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: rename direct_base_parent to direct_base_derived
authorMarek Polacek <polacek@redhat.com>
Fri, 16 Jan 2026 21:26:09 +0000 (16:26 -0500)
committerMarek Polacek <polacek@redhat.com>
Sun, 18 Jan 2026 15:51:03 +0000 (10:51 -0500)
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 <jason@redhat.com>
gcc/cp/cp-tree.h
gcc/cp/decl2.cc
gcc/cp/pt.cc
gcc/cp/reflect.cc

index d7acfc8b7a332bd82a83211baa459d6c24b189a5..cef8a8e5c196c17e83e5d191b649ff65d5a84d5e 100644 (file)
@@ -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);
index 4de6345135f81437a37866efda00edfe01c35167..6dbfdeada2059ced7d02939dd4dd095f7b7b5929 100644 (file)
@@ -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:
index 3c9ba31b212d4ab4910ed7b8f8d116d4968c1528..4906de000e6671a3ba8e6daacaeab186150bdafc 100644 (file)
@@ -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.  */
index 9e2eeab05bc77397223e33bd2a2c6a9a0869c96e..c2cc6948798ab43360693398ecb3a1539ed510e0 100644 (file)
@@ -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