/* C language support routines for GDB, the GNU debugger.
- Copyright (C) 1992-2019 Free Software Foundation, Inc.
+ Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of GDB.
that would do the wrong thing. */
while (elttype)
{
- const char *name = TYPE_NAME (elttype);
+ const char *name = elttype->name ();
- if (TYPE_CODE (elttype) == TYPE_CODE_CHAR || !name)
+ if (elttype->code () == TYPE_CODE_CHAR || !name)
{
result = C_CHAR;
goto done;
goto done;
}
- if (TYPE_CODE (elttype) != TYPE_CODE_TYPEDEF)
+ if (elttype->code () != TYPE_CODE_TYPEDEF)
break;
/* Call for side effects. */
if (element_type == NULL)
goto error;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
/* If we know the size of the array, we can use it as a limit on
the number of characters to be fetched. */
if (TYPE_NFIELDS (type) == 1
- && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE)
+ && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_RANGE)
{
LONGEST low_bound, high_bound;
else
fetchlimit = UINT_MAX;
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ else if (type->code () == TYPE_CODE_PTR)
fetchlimit = UINT_MAX;
else
/* We work only with arrays and pointers. */
avoids running off the end of the value's contents. */
if ((VALUE_LVAL (value) == not_lval
|| VALUE_LVAL (value) == lval_internalvar
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ || type->code () == TYPE_CODE_ARRAY)
&& fetchlimit != UINT_MAX
&& (*length < 0 || *length <= fetchlimit))
{
if (*length >= 0)
i = *length;
else
- /* Otherwise, look for a null character. */
- for (i = 0; i < fetchlimit; i++)
+ /* Otherwise, look for a null character. */
+ for (i = 0; i < fetchlimit; i++)
if (extract_unsigned_integer (contents + i * width,
width, byte_order) == 0)
- break;
+ break;
/* I is now either a user-defined length, the number of non-null
- characters, or FETCHLIMIT. */
+ characters, or FETCHLIMIT. */
*length = i * width;
buffer->reset ((gdb_byte *) xmalloc (*length));
memcpy (buffer->get (), contents, *length);
c_style_arrays is false, so we handle that specially
here. */
CORE_ADDR addr;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
if (VALUE_LVAL (value) != lval_memory)
error (_("Attempt to take address of value "
exp->gdbarch);
break;
case C_WIDE_STRING:
- type = lookup_typename (exp->language_defn, exp->gdbarch,
- "wchar_t", NULL, 0);
+ type = lookup_typename (exp->language_defn, "wchar_t", NULL, 0);
break;
case C_STRING_16:
- type = lookup_typename (exp->language_defn, exp->gdbarch,
- "char16_t", NULL, 0);
+ type = lookup_typename (exp->language_defn, "char16_t", NULL, 0);
break;
case C_STRING_32:
- type = lookup_typename (exp->language_defn, exp->gdbarch,
- "char32_t", NULL, 0);
+ type = lookup_typename (exp->language_defn, "char32_t", NULL, 0);
break;
default:
internal_error (__FILE__, __LINE__, _("unhandled c_string_type"));
/* If the caller expects an array of some integral type,
satisfy them. If something odder is expected, rely on the
caller to cast. */
- if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_ARRAY)
+ if (expect_type && expect_type->code () == TYPE_CODE_ARRAY)
{
struct type *element_type
= check_typedef (TYPE_TARGET_TYPE (expect_type));
- if (TYPE_CODE (element_type) == TYPE_CODE_INT
- || TYPE_CODE (element_type) == TYPE_CODE_CHAR)
+ if (element_type->code () == TYPE_CODE_INT
+ || element_type->code () == TYPE_CODE_CHAR)
{
type = element_type;
satisfy_expected = 1;
c_is_string_type_p (struct type *type)
{
type = check_typedef (type);
- while (TYPE_CODE (type) == TYPE_CODE_REF)
+ while (type->code () == TYPE_CODE_REF)
{
type = TYPE_TARGET_TYPE (type);
type = check_typedef (type);
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
{
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
+ c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
+ c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
cplus_skip_trampoline, /* Language specific skip_trampoline */
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
+ c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */
0, /* String lower bound */
default_word_break_characters,
default_collect_symbol_completion_matches,
- c_language_arch_info, /* FIXME: la_language_arch_info. */
+ c_language_arch_info, /* FIXME: la_language_arch_info. */
default_print_array_index,
default_pass_by_reference,
c_watch_location_expression,
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
+ c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
NULL, /* Language specific skip_trampoline */