From 809f3be12c0621cbf071c585da5638f6841c38b1 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 11 Sep 2021 13:58:04 -0600 Subject: 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.) --- gdb/c-varobj.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'gdb/c-varobj.c') 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) -- cgit v1.1