aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-09-11 13:58:04 -0600
committerTom Tromey <tom@tromey.com>2021-09-23 15:11:00 -0600
commit809f3be12c0621cbf071c585da5638f6841c38b1 (patch)
treec0a9beeebaf38da9fb3a3e7447f4cb18a624479f /gdb/value.c
parent0086a91ceef5207463a10c875ed85c40eb066722 (diff)
downloadfsf-binutils-gdb-809f3be12c0621cbf071c585da5638f6841c38b1.zip
fsf-binutils-gdb-809f3be12c0621cbf071c585da5638f6841c38b1.tar.gz
fsf-binutils-gdb-809f3be12c0621cbf071c585da5638f6841c38b1.tar.bz2
Change pointer_type to a method of struct type
I noticed that pointer_type is declared in language.h and defined in language.c. However, it really has to do with types, so it should have been in gdbtypes.h all along. This patch changes it to be a method on struct type. And, I went through uses of TYPE_IS_REFERENCE and updated many spots to use the new method as well. (I didn't update ones that were in arch-specific code, as I couldn't readily test that.)
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 2cbaadc..3a2bc13 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1182,7 +1182,7 @@ value_actual_type (struct value *value, int resolve_simple_types,
{
/* If result's target type is TYPE_CODE_STRUCT, proceed to
fetch its rtti type. */
- if ((result->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result))
+ if (result->is_pointer_or_reference ()
&& (check_typedef (TYPE_TARGET_TYPE (result))->code ()
== TYPE_CODE_STRUCT)
&& !value_optimized_out (value))
@@ -2778,8 +2778,7 @@ value_as_address (struct value *val)
converted to pointers; usually, the ABI doesn't either, but
ABI-specific code is a more reasonable place to handle it. */
- if (value_type (val)->code () != TYPE_CODE_PTR
- && !TYPE_IS_REFERENCE (value_type (val))
+ if (!value_type (val)->is_pointer_or_reference ()
&& gdbarch_integer_to_address_p (gdbarch))
return gdbarch_integer_to_address (gdbarch, value_type (val),
value_contents (val));
@@ -3726,8 +3725,7 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type,
struct value *original_value,
CORE_ADDR original_value_address)
{
- gdb_assert (original_type->code () == TYPE_CODE_PTR
- || TYPE_IS_REFERENCE (original_type));
+ gdb_assert (original_type->is_pointer_or_reference ());
struct type *original_target_type = TYPE_TARGET_TYPE (original_type);
gdb::array_view<const gdb_byte> view;