aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-varobj.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/c-varobj.c
parent0086a91ceef5207463a10c875ed85c40eb066722 (diff)
downloadbinutils-809f3be12c0621cbf071c585da5638f6841c38b1.zip
binutils-809f3be12c0621cbf071c585da5638f6841c38b1.tar.gz
binutils-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/c-varobj.c')
-rw-r--r--gdb/c-varobj.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/c-varobj.c b/gdb/c-varobj.c
index f6db3a5..8056c1c 100644
--- a/gdb/c-varobj.c
+++ b/gdb/c-varobj.c
@@ -574,8 +574,7 @@ cplus_number_of_children (const struct varobj *var)
if (opts.objectprint)
{
value = var->value.get ();
- lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
- || var->type->code () == TYPE_CODE_PTR);
+ lookup_actual_type = var->type->is_pointer_or_reference ();
}
adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
@@ -611,8 +610,7 @@ cplus_number_of_children (const struct varobj *var)
const struct varobj *parent = var->parent;
value = parent->value.get ();
- lookup_actual_type = (TYPE_IS_REFERENCE (parent->type)
- || parent->type->code () == TYPE_CODE_PTR);
+ lookup_actual_type = parent->type->is_pointer_or_reference ();
}
adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
@@ -716,8 +714,7 @@ cplus_describe_child (const struct varobj *parent, int index,
var = (CPLUS_FAKE_CHILD (parent)) ? parent->parent : parent;
if (opts.objectprint)
- lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
- || var->type->code () == TYPE_CODE_PTR);
+ lookup_actual_type = var->type->is_pointer_or_reference ();
value = var->value.get ();
type = varobj_get_value_type (var);
if (cfull_expression)