Turn allocate_computed_value into static "constructor"
authorTom Tromey <tom@tromey.com>
Tue, 31 Jan 2023 20:29:49 +0000 (13:29 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 13 Feb 2023 22:21:07 +0000 (15:21 -0700)
This turns allocate_computed_value into a static "constructor" of
value.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/dwarf2/expr.c
gdb/dwarf2/loc.c
gdb/infrun.c
gdb/opencl-lang.c
gdb/value.c
gdb/value.h
gdb/windows-tdep.c

index fc92de85840b04de2abff2bf3a72779438494bab..ad6cf563562d8b6a7cb6175db833a42935bb2064 100644 (file)
@@ -932,7 +932,7 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type,
       piece_closure *c
        = allocate_piece_closure (this->m_per_cu, this->m_per_objfile,
                                  std::move (this->m_pieces), this->m_frame);
-      retval = allocate_computed_value (subobj_type,
+      retval = value::allocate_computed (subobj_type,
                                        &pieced_value_funcs, c);
       retval->set_offset (subobj_offset);
     }
index 2e0b4a8b45db252a7790ea35070d0833b7950fce..743a0cefd6dc3b931803f8ee077cd5c49236f3ee 100644 (file)
@@ -1359,7 +1359,7 @@ value_of_dwarf_reg_entry (struct type *type, frame_info_ptr frame,
                                               caller_per_cu,
                                               caller_per_objfile);
 
-  val = allocate_computed_value (type, &entry_data_value_funcs,
+  val = value::allocate_computed (type, &entry_data_value_funcs,
                                 release_value (target_val).release ());
 
   /* Copy the referencing pointer to the new computed value.  */
index acf93033a86f6ccbe2b47d84a844a57554aec728..c45c6b5c8021f4edd3f35418e14dd8b1e5fbb114 100644 (file)
@@ -9194,7 +9194,7 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
     {
       struct type *type = gdbarch_get_siginfo_type (gdbarch);
 
-      return allocate_computed_value (type, &siginfo_value_funcs, nullptr);
+      return value::allocate_computed (type, &siginfo_value_funcs, nullptr);
     }
 
   return value::allocate (builtin_type (gdbarch)->builtin_void);
index c76f948a3ed522580b7fb4581a3534b1eeceb6df..25be86ee98a3d5249579eff125eb8972f3cfad81 100644 (file)
@@ -304,7 +304,7 @@ create_value (struct gdbarch *gdbarch, struct value *val, enum noside noside,
          if (VALUE_LVAL (val) != not_lval && !array_has_dups (indices, n))
            {
              struct lval_closure *c = allocate_lval_closure (indices, n, val);
-             ret = allocate_computed_value (dst_type, &opencl_value_funcs, c);
+             ret = value::allocate_computed (dst_type, &opencl_value_funcs, c);
            }
          else
            {
index 11c9237c91e7e96a7d4cd1c3cbeb4b3b593591d7..7fb12d8e9a6e4588eaa1a4c5ffba61d4bdaa46c6 100644 (file)
@@ -995,9 +995,9 @@ allocate_repeat_value (struct type *type, int count)
 }
 
 struct value *
-allocate_computed_value (struct type *type,
-                        const struct lval_funcs *funcs,
-                        void *closure)
+value::allocate_computed (struct type *type,
+                         const struct lval_funcs *funcs,
+                         void *closure)
 {
   struct value *v = value::allocate_lazy (type);
 
index c1c9199168e26c974c51a6e398d036af9c7389d6..dbbb61932b8fbd4acd866826b79eec99984f827c 100644 (file)
@@ -169,6 +169,12 @@ public:
   /* Allocate a value and its contents for type TYPE.  */
   static struct value *allocate (struct type *type);
 
+  /* Create a computed lvalue, with type TYPE, function pointers
+     FUNCS, and closure CLOSURE.  */
+  static struct value *allocate_computed (struct type *type,
+                                         const struct lval_funcs *funcs,
+                                         void *closure);
+
   ~value ();
 
   DISABLE_COPY_AND_ASSIGN (value);
@@ -619,13 +625,6 @@ struct lval_funcs
   void (*free_closure) (struct value *v);
 };
 
-/* Create a computed lvalue, with type TYPE, function pointers FUNCS,
-   and closure CLOSURE.  */
-
-extern struct value *allocate_computed_value (struct type *type,
-                                             const struct lval_funcs *funcs,
-                                             void *closure);
-
 extern struct value *allocate_optimized_out_value (struct type *type);
 
 /* Throw an error complaining that the value has been optimized
index 741333cf67735c18fb5b9442d5421ea95697736f..893e34d9912a617925d3330b0a334e76c937e55a 100644 (file)
@@ -433,7 +433,7 @@ tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
   if (target_has_stack () && inferior_ptid != null_ptid)
     {
       struct type *type = windows_get_tlb_type (gdbarch);
-      return allocate_computed_value (type, &tlb_value_funcs, NULL);
+      return value::allocate_computed (type, &tlb_value_funcs, NULL);
     }
 
   return value::allocate (builtin_type (gdbarch)->builtin_void);