]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove evaluate_type
authorTom Tromey <tromey@adacore.com>
Fri, 28 Apr 2023 13:26:44 +0000 (07:26 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 1 May 2023 17:04:13 +0000 (11:04 -0600)
Like evaluate_expression, evaluate_type is also just a simple wrapper.
Removing it makes the code a little nicer.

gdb/dtrace-probe.c
gdb/eval.c
gdb/expression.h
gdb/gnu-v3-abi.c
gdb/mi/mi-main.c
gdb/typeprint.c
gdb/value.h
gdb/varobj.c

index dad15df5b99b0e9a55e087dae347ea9375deaac1..a742c3c25e3ff2f1805638778a1f284e6c901a95 100644 (file)
@@ -494,7 +494,7 @@ dtrace_process_dof_probe (struct objfile *objfile,
            }
 
          if (expr != NULL && expr->first_opcode () == OP_TYPE)
-           type = evaluate_type (expr.get ())->type ();
+           type = expr->evaluate_type ()->type ();
 
          args.emplace_back (type, std::move (type_str), std::move (expr));
        }
index 82b5fe26b62a95e24daed6c7f77e81ab6525101c..9d5ca0b47de80a8beb79849944fd8bf8a8e1e226 100644 (file)
@@ -116,15 +116,6 @@ expression::evaluate (struct type *expect_type, enum noside noside)
   return retval;
 }
 
-/* Evaluate an expression, avoiding all memory references
-   and getting a value whose type alone is correct.  */
-
-struct value *
-evaluate_type (struct expression *exp)
-{
-  return exp->evaluate (nullptr, EVAL_AVOID_SIDE_EFFECTS);
-}
-
 /* Find the current value of a watchpoint on EXP.  Return the value in
    *VALP and *RESULTP and the chain of intermediate and final values
    in *VAL_CHAIN.  RESULTP and VAL_CHAIN may be NULL if the caller does
index 5bfb051a393db8413325199ecc00b9ae5455456b..e6e4bec2e80368e9ab9556ac2ae89ac6c4618a00 100644 (file)
@@ -225,6 +225,11 @@ struct expression
   struct value *evaluate (struct type *expect_type = nullptr,
                          enum noside noside = EVAL_NORMAL);
 
+  /* Evaluate an expression, avoiding all memory references
+     and getting a value whose type alone is correct.  */
+  struct value *evaluate_type ()
+  { return evaluate (nullptr, EVAL_AVOID_SIDE_EFFECTS); }
+
   /* Language it was entered in.  */
   const struct language_defn *language_defn;
   /* Architecture it was parsed in.  */
index 4d1aa12746fbd7d131d76e18131465d0b529134c..2c7c83e67b1c25577158674fb138015e7a93eecf 100644 (file)
@@ -1211,7 +1211,7 @@ gnuv3_get_type_from_type_info (struct value *type_info_ptr)
      internal form to reconstruct the type somehow.  */
   std::string type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
   expression_up expr (parse_expression (type_name.c_str ()));
-  struct value *type_val = evaluate_type (expr.get ());
+  struct value *type_val = expr->evaluate_type ();
   return type_val->type ();
 }
 
index 683d36d93d511f75a6e756a3309117d77b92d6ac..19cdf47a28354470456584fb800173a38159f6c6 100644 (file)
@@ -2466,7 +2466,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
   expression_up expr = parse_expression (expression);
 
   if (values == PRINT_SIMPLE_VALUES)
-    val = evaluate_type (expr.get ());
+    val = expr->evaluate_type ();
   else
     val = expr->evaluate ();
 
index bfe851f348ca855a11f3aa807bf1382d205ec702..01c11629a70bfaf796368eab18f642e6c7f840b8 100644 (file)
@@ -511,7 +511,7 @@ whatis_exp (const char *exp, int show)
         "whatis" prints the type of the expression without stripping
         any typedef level.  "ptype" always strips all levels of
         typedefs.  */
-      val = evaluate_type (expr.get ());
+      val = expr->evaluate_type ();
       type = val->type ();
 
       if (show == -1 && expr->first_opcode () == OP_TYPE)
@@ -708,7 +708,7 @@ maintenance_print_type (const char *type_name, int from_tty)
   if (type_name != NULL)
     {
       expression_up expr = parse_expression (type_name);
-      struct value *val = evaluate_type (expr.get ());
+      struct value *val = expr->evaluate_type ();
       struct type *type = val->type ();
 
       if (type != nullptr)
index f6092aba5a447f0a532505f902ea6b27d8b95a04..d042d816409e60fafff0859ef6578188d1f68ef5 100644 (file)
@@ -1299,8 +1299,6 @@ extern int using_struct_return (struct gdbarch *gdbarch,
                                struct value *function,
                                struct type *value_type);
 
-extern struct value *evaluate_type (struct expression *exp);
-
 extern value *evaluate_var_value (enum noside noside, const block *blk,
                                  symbol *var);
 
index 75b4d44b1091badd93ccbc5bf9b11ff8c6c8502e..dd39784a21c65a895467e9612730dee0025bbe80 100644 (file)
@@ -375,7 +375,7 @@ varobj_create (const char *objname,
        {
          /* Error getting the value.  Try to at least get the
             right type.  */
-         struct value *type_only_value = evaluate_type (var->root->exp.get ());
+         struct value *type_only_value = var->root->exp->evaluate_type ();
 
          var->type = type_only_value->type ();
        }