Turn value_type into method
This changes value_type to be a method of value. Much of this patch was written by script. Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
parent
7cf57bc5be
commit
d0c9791728
107 changed files with 880 additions and 884 deletions
|
@ -206,10 +206,10 @@ mi_should_print (struct symbol *sym, enum mi_print_types type)
|
|||
static void
|
||||
py_print_type (struct ui_out *out, struct value *val)
|
||||
{
|
||||
check_typedef (value_type (val));
|
||||
check_typedef (val->type ());
|
||||
|
||||
string_file stb;
|
||||
type_print (value_type (val), "", &stb, -1);
|
||||
type_print (val->type (), "", &stb, -1);
|
||||
out->field_stream ("type", stb);
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ py_print_value (struct ui_out *out, struct value *val,
|
|||
if (args_type == MI_PRINT_SIMPLE_VALUES
|
||||
|| args_type == MI_PRINT_ALL_VALUES)
|
||||
{
|
||||
struct type *type = check_typedef (value_type (val));
|
||||
struct type *type = check_typedef (val->type ());
|
||||
|
||||
if (args_type == MI_PRINT_ALL_VALUES)
|
||||
should_print = 1;
|
||||
|
@ -378,7 +378,7 @@ py_print_single_arg (struct ui_out *out,
|
|||
py_print_type (out, val);
|
||||
|
||||
if (val != NULL)
|
||||
annotate_arg_value (value_type (val));
|
||||
annotate_arg_value (val->type ());
|
||||
|
||||
/* If the output is to the CLI, and the user option "set print
|
||||
frame-arguments" is set to none, just output "...". */
|
||||
|
|
|
@ -715,7 +715,7 @@ infpy_thread_from_thread_handle (PyObject *self, PyObject *args, PyObject *kw)
|
|||
{
|
||||
struct value *val = value_object_to_value (handle_obj);
|
||||
bytes = value_contents_all (val).data ();
|
||||
bytes_len = value_type (val)->length ();
|
||||
bytes_len = val->type ()->length ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -574,7 +574,7 @@ gdbpy_apply_val_pretty_printer (const struct extension_language_defn *extlang,
|
|||
const struct value_print_options *options,
|
||||
const struct language_defn *language)
|
||||
{
|
||||
struct type *type = value_type (value);
|
||||
struct type *type = value->type ();
|
||||
struct gdbarch *gdbarch = type->arch ();
|
||||
enum gdbpy_string_repr_result print_result;
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ pyuw_value_obj_to_pointer (PyObject *pyo_value, CORE_ADDR *addr)
|
|||
{
|
||||
if ((value = value_object_to_value (pyo_value)) != NULL)
|
||||
{
|
||||
*addr = unpack_pointer (value_type (value),
|
||||
*addr = unpack_pointer (value->type (),
|
||||
value_contents (value).data ());
|
||||
rc = 1;
|
||||
}
|
||||
|
@ -292,13 +292,13 @@ unwind_infopy_add_saved_register (PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
data_size = register_size (pending_frame->gdbarch, regnum);
|
||||
if (data_size != value_type (value)->length ())
|
||||
if (data_size != value->type ()->length ())
|
||||
{
|
||||
PyErr_Format (
|
||||
PyExc_ValueError,
|
||||
"The value of the register returned by the Python "
|
||||
"sniffer has unexpected size: %u instead of %u.",
|
||||
(unsigned) value_type (value)->length (),
|
||||
(unsigned) value->type ()->length (),
|
||||
(unsigned) data_size);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ pyuw_sniffer (const struct frame_unwind *self, frame_info_ptr this_frame,
|
|||
|
||||
/* `value' validation was done before, just assert. */
|
||||
gdb_assert (value != NULL);
|
||||
gdb_assert (data_size == value_type (value)->length ());
|
||||
gdb_assert (data_size == value->type ()->length ());
|
||||
|
||||
cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
|
||||
memcpy (cached_frame->reg[i].data,
|
||||
|
|
|
@ -272,7 +272,7 @@ valpy_referenced_value (PyObject *self, PyObject *args)
|
|||
scoped_value_mark free_values;
|
||||
|
||||
self_val = ((value_object *) self)->value;
|
||||
switch (check_typedef (value_type (self_val))->code ())
|
||||
switch (check_typedef (self_val->type ())->code ())
|
||||
{
|
||||
case TYPE_CODE_PTR:
|
||||
res_val = value_ind (self_val);
|
||||
|
@ -391,7 +391,7 @@ valpy_get_type (PyObject *self, void *closure)
|
|||
|
||||
if (!obj->type)
|
||||
{
|
||||
obj->type = type_to_type_object (value_type (obj->value));
|
||||
obj->type = type_to_type_object (obj->value->type ());
|
||||
if (!obj->type)
|
||||
return NULL;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure)
|
|||
struct value *val = obj->value;
|
||||
scoped_value_mark free_values;
|
||||
|
||||
type = value_type (val);
|
||||
type = val->type ();
|
||||
type = check_typedef (type);
|
||||
|
||||
if (type->is_pointer_or_reference ()
|
||||
|
@ -506,7 +506,7 @@ valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
|
|||
struct type *type, *realtype;
|
||||
CORE_ADDR addr;
|
||||
|
||||
type = value_type (value);
|
||||
type = value->type ();
|
||||
realtype = check_typedef (type);
|
||||
|
||||
switch (realtype->code ())
|
||||
|
@ -885,7 +885,7 @@ value_has_field (struct value *v, PyObject *field)
|
|||
|
||||
try
|
||||
{
|
||||
val_type = value_type (v);
|
||||
val_type = v->type ();
|
||||
val_type = check_typedef (val_type);
|
||||
if (val_type->is_pointer_or_reference ())
|
||||
val_type = check_typedef (val_type->target_type ());
|
||||
|
@ -1037,7 +1037,7 @@ valpy_getitem (PyObject *self, PyObject *key)
|
|||
{
|
||||
struct type *val_type;
|
||||
|
||||
val_type = check_typedef (value_type (tmp));
|
||||
val_type = check_typedef (tmp->type ());
|
||||
if (val_type->code () == TYPE_CODE_PTR)
|
||||
res_val = value_cast (lookup_pointer_type (base_class_type), tmp);
|
||||
else if (val_type->code () == TYPE_CODE_REF)
|
||||
|
@ -1063,7 +1063,7 @@ valpy_getitem (PyObject *self, PyObject *key)
|
|||
struct type *type;
|
||||
|
||||
tmp = coerce_ref (tmp);
|
||||
type = check_typedef (value_type (tmp));
|
||||
type = check_typedef (tmp->type ());
|
||||
if (type->code () != TYPE_CODE_ARRAY
|
||||
&& type->code () != TYPE_CODE_PTR)
|
||||
error (_("Cannot subscript requested type."));
|
||||
|
@ -1106,7 +1106,7 @@ valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
|
|||
|
||||
try
|
||||
{
|
||||
ftype = check_typedef (value_type (function));
|
||||
ftype = check_typedef (function->type ());
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
|
@ -1311,8 +1311,8 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other)
|
|||
{
|
||||
case VALPY_ADD:
|
||||
{
|
||||
struct type *ltype = value_type (arg1);
|
||||
struct type *rtype = value_type (arg2);
|
||||
struct type *ltype = arg1->type ();
|
||||
struct type *rtype = arg2->type ();
|
||||
|
||||
ltype = check_typedef (ltype);
|
||||
ltype = STRIP_REFERENCE (ltype);
|
||||
|
@ -1335,8 +1335,8 @@ valpy_binop_throw (enum valpy_opcode opcode, PyObject *self, PyObject *other)
|
|||
break;
|
||||
case VALPY_SUB:
|
||||
{
|
||||
struct type *ltype = value_type (arg1);
|
||||
struct type *rtype = value_type (arg2);
|
||||
struct type *ltype = arg1->type ();
|
||||
struct type *rtype = arg2->type ();
|
||||
|
||||
ltype = check_typedef (ltype);
|
||||
ltype = STRIP_REFERENCE (ltype);
|
||||
|
@ -1506,7 +1506,7 @@ valpy_absolute (PyObject *self)
|
|||
{
|
||||
scoped_value_mark free_values;
|
||||
|
||||
if (value_less (value, value_zero (value_type (value), not_lval)))
|
||||
if (value_less (value, value_zero (value->type (), not_lval)))
|
||||
isabs = 0;
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
|
@ -1531,7 +1531,7 @@ valpy_nonzero (PyObject *self)
|
|||
|
||||
try
|
||||
{
|
||||
type = check_typedef (value_type (self_value->value));
|
||||
type = check_typedef (self_value->value->type ());
|
||||
|
||||
if (is_integral_type (type) || type->code () == TYPE_CODE_PTR)
|
||||
nonzero = !!value_as_long (self_value->value);
|
||||
|
@ -1712,7 +1712,7 @@ static PyObject *
|
|||
valpy_long (PyObject *self)
|
||||
{
|
||||
struct value *value = ((value_object *) self)->value;
|
||||
struct type *type = value_type (value);
|
||||
struct type *type = value->type ();
|
||||
LONGEST l = 0;
|
||||
|
||||
try
|
||||
|
@ -1747,7 +1747,7 @@ static PyObject *
|
|||
valpy_float (PyObject *self)
|
||||
{
|
||||
struct value *value = ((value_object *) self)->value;
|
||||
struct type *type = value_type (value);
|
||||
struct type *type = value->type ();
|
||||
double d = 0;
|
||||
|
||||
try
|
||||
|
@ -1995,7 +1995,7 @@ gdbpy_convenience_variable (PyObject *self, PyObject *args)
|
|||
if (var != NULL)
|
||||
{
|
||||
res_val = value_of_internalvar (gdbpy_enter::get_gdbarch (), var);
|
||||
if (value_type (res_val)->code () == TYPE_CODE_VOID)
|
||||
if (res_val->type ()->code () == TYPE_CODE_VOID)
|
||||
res_val = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -423,7 +423,7 @@ python_xmethod_worker::do_get_result_type (value *obj,
|
|||
return EXT_LANG_RC_OK;
|
||||
}
|
||||
|
||||
obj_type = check_typedef (value_type (obj));
|
||||
obj_type = check_typedef (obj->type ());
|
||||
this_type = check_typedef (type_object_to_type (m_this_type));
|
||||
if (obj_type->code () == TYPE_CODE_PTR)
|
||||
{
|
||||
|
@ -508,7 +508,7 @@ python_xmethod_worker::invoke (struct value *obj,
|
|||
struct type *obj_type, *this_type;
|
||||
struct value *res = NULL;
|
||||
|
||||
obj_type = check_typedef (value_type (obj));
|
||||
obj_type = check_typedef (obj->type ());
|
||||
this_type = check_typedef (type_object_to_type (m_this_type));
|
||||
if (obj_type->code () == TYPE_CODE_PTR)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue