]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/dwarf2/loc.c
Turn many optimized-out value functions into methods
[thirdparty/binutils-gdb.git] / gdb / dwarf2 / loc.c
index e975f280cfc289be4ccfa6350069505594c31574..616db13488b95be81b52765a59d78c588692dc40 100644 (file)
@@ -516,7 +516,7 @@ locexpr_get_frame_base (struct symbol *framefunc, frame_info_ptr frame)
      dwarf2_evaluate_loc_desc returns a value representing a variable at
      that address.  The frame base address is thus this variable's
      address.  */
-  return value_address (result);
+  return result->address ();
 }
 
 /* Vector for inferior functions as represented by LOC_BLOCK, if the inferior
@@ -573,7 +573,7 @@ loclist_get_frame_base (struct symbol *framefunc, frame_info_ptr frame)
      dwarf2_evaluate_loc_desc returns a value representing a variable at
      that address.  The frame base address is thus this variable's
      address.  */
-  return value_address (result);
+  return result->address ();
 }
 
 /* Vector for inferior functions as represented by LOC_BLOCK, if the inferior
@@ -685,7 +685,7 @@ call_site_target::iterate_over_addresses
                                        dwarf_block->per_objfile);
        /* DW_AT_call_target is a DWARF expression, not a DWARF location.  */
        if (VALUE_LVAL (val) == lval_memory)
-         callback (value_address (val));
+         callback (val->address ());
        else
          callback (value_as_address (val));
       }
@@ -1280,7 +1280,7 @@ entry_data_value_coerce_ref (const struct value *value)
     return NULL;
 
   target_val = (struct value *) value->computed_closure ();
-  value_incref (target_val);
+  target_val->incref ();
   return target_val;
 }
 
@@ -1291,7 +1291,7 @@ entry_data_value_copy_closure (const struct value *v)
 {
   struct value *target_val = (struct value *) v->computed_closure ();
 
-  value_incref (target_val);
+  target_val->incref ();
   return target_val;
 }
 
@@ -1302,7 +1302,7 @@ entry_data_value_free_closure (struct value *v)
 {
   struct value *target_val = (struct value *) v->computed_closure ();
 
-  value_decref (target_val);
+  target_val->decref ();
 }
 
 /* Vector for methods for an entry value reference where the referenced value
@@ -1359,12 +1359,12 @@ 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.  */
-  memcpy (value_contents_raw (val).data (),
-         value_contents_raw (outer_val).data (),
+  memcpy (val->contents_raw ().data (),
+         outer_val->contents_raw ().data (),
          checked_type->length ());
   val->set_lazy (0);
 
@@ -1429,7 +1429,7 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset,
        invalid_synthetic_pointer ();
     }
   else
-    result = allocate_optimized_out_value (type->target_type ());
+    result = value::allocate_optimized_out (type->target_type ());
 
   return result;
 }
@@ -1497,7 +1497,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
     invalid_synthetic_pointer ();
 
   if (size == 0)
-    return allocate_optimized_out_value (subobj_type);
+    return value::allocate_optimized_out (subobj_type);
 
   dwarf_expr_context ctx (per_objfile, per_cu->addr_size ());
 
@@ -1514,9 +1514,9 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
       if (ex.error == NOT_AVAILABLE_ERROR)
        {
          free_values.free_to_mark ();
-         retval = allocate_value (subobj_type);
-         mark_value_bytes_unavailable (retval, 0,
-                                       subobj_type->length ());
+         retval = value::allocate (subobj_type);
+         retval->mark_bytes_unavailable (0,
+                                         subobj_type->length ());
          return retval;
        }
       else if (ex.error == NO_ENTRY_VALUE_ERROR)
@@ -1524,7 +1524,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
          if (entry_values_debug)
            exception_print (gdb_stdout, ex);
          free_values.free_to_mark ();
-         return allocate_optimized_out_value (subobj_type);
+         return value::allocate_optimized_out (subobj_type);
        }
       else
        throw;
@@ -1538,7 +1538,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, frame_info_ptr frame,
   value_ref_ptr value_holder = value_ref_ptr::new_reference (retval);
   free_values.free_to_mark ();
 
-  return value_copy (retval);
+  return retval->copy ();
 }
 
 /* The exported interface to dwarf2_evaluate_loc_desc_full; it always
@@ -1609,11 +1609,11 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
        throw;
     }
 
-  if (value_optimized_out (result))
+  if (result->optimized_out ())
     return 0;
 
   if (VALUE_LVAL (result) == lval_memory)
-    *valp = value_address (result);
+    *valp = result->address ();
   else
     {
       if (VALUE_LVAL (result) == not_lval)
@@ -1709,7 +1709,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop,
            val = dwarf2_evaluate_loc_desc (baton->property_type, frame, data,
                                            size, baton->loclist.per_cu,
                                            baton->loclist.per_objfile);
-           if (!value_optimized_out (val))
+           if (!val->optimized_out ())
              {
                *value = value_as_address (val);
                return true;
@@ -3906,11 +3906,11 @@ loclist_read_variable_at_entry (struct symbol *symbol, frame_info_ptr frame)
   CORE_ADDR pc;
 
   if (frame == NULL || !get_frame_func_if_available (frame, &pc))
-    return allocate_optimized_out_value (symbol->type ());
+    return value::allocate_optimized_out (symbol->type ());
 
   data = dwarf2_find_location_expression (dlbaton, &size, pc);
   if (data == NULL)
-    return allocate_optimized_out_value (symbol->type ());
+    return value::allocate_optimized_out (symbol->type ());
 
   return value_of_dwarf_block_entry (symbol->type (), frame, data, size);
 }