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/valops.c | |
parent | 0086a91ceef5207463a10c875ed85c40eb066722 (diff) | |
download | gdb-809f3be12c0621cbf071c585da5638f6841c38b1.zip gdb-809f3be12c0621cbf071c585da5638f6841c38b1.tar.gz 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/valops.c')
-rw-r--r-- | gdb/valops.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 50874a5..6729860 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2335,7 +2335,7 @@ value_struct_elt (struct value **argp, /* Follow pointers until we get to a non-pointer. */ - while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) + while (t->is_pointer_or_reference ()) { *argp = value_ind (*argp); /* Don't coerce fn pointer to fn and then back again! */ @@ -2422,7 +2422,7 @@ value_struct_elt_bitpos (struct value **argp, int bitpos, struct type *ftype, t = check_typedef (value_type (*argp)); - while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) + while (t->is_pointer_or_reference ()) { *argp = value_ind (*argp); if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC) @@ -2575,7 +2575,7 @@ value_find_oload_method_list (struct value **argp, const char *method, t = check_typedef (value_type (*argp)); /* Code snarfed from value_struct_elt. */ - while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t)) + while (t->is_pointer_or_reference ()) { *argp = value_ind (*argp); /* Don't coerce fn pointer to fn and then back again! */ @@ -2969,8 +2969,7 @@ find_overload_match (gdb::array_view<value *> args, struct type *objtype = check_typedef (obj_type); if (temp_type->code () != TYPE_CODE_PTR - && (objtype->code () == TYPE_CODE_PTR - || TYPE_IS_REFERENCE (objtype))) + && objtype->is_pointer_or_reference ()) { temp = value_addr (temp); } |