diff options
author | Tom Tromey <tom@tromey.com> | 2021-09-11 13:58:04 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2021-09-23 15:11:00 -0600 |
commit | 809f3be12c0621cbf071c585da5638f6841c38b1 (patch) | |
tree | c0a9beeebaf38da9fb3a3e7447f4cb18a624479f /gdb/python/py-value.c | |
parent | 0086a91ceef5207463a10c875ed85c40eb066722 (diff) | |
download | binutils-gdb-809f3be12c0621cbf071c585da5638f6841c38b1.tar.gz |
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/python/py-value.c')
-rw-r--r-- | gdb/python/py-value.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 26d5940f842..d45df5fd113 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -400,7 +400,7 @@ valpy_get_dynamic_type (PyObject *self, void *closure) type = value_type (val); type = check_typedef (type); - if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type)) + if (type->is_pointer_or_reference () && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT)) { struct value *target; @@ -851,7 +851,7 @@ value_has_field (struct value *v, PyObject *field) { val_type = value_type (v); val_type = check_typedef (val_type); - if (TYPE_IS_REFERENCE (val_type) || val_type->code () == TYPE_CODE_PTR) + if (val_type->is_pointer_or_reference ()) val_type = check_typedef (TYPE_TARGET_TYPE (val_type)); type_code = val_type->code (); |