diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2022-07-30 12:07:39 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2022-09-21 10:53:55 -0400 |
commit | 8a50fdcefc44c40d5c4b978f19c22ddfbeb29139 (patch) | |
tree | 423aae459c642ed5542af312098835612df0ec84 /gdb/ctfread.c | |
parent | 0242db993f8ad0a0de16dafc4ebd35bb6190c833 (diff) | |
download | gdb-8a50fdcefc44c40d5c4b978f19c22ddfbeb29139.zip gdb-8a50fdcefc44c40d5c4b978f19c22ddfbeb29139.tar.gz gdb-8a50fdcefc44c40d5c4b978f19c22ddfbeb29139.tar.bz2 |
gdb: add type::target_type / type::set_target_type
Add the `target_type` and `set_target_type` methods on `struct type`, in order
to remove the `TYPE_TARGET_TYPE` macro. In this patch, the macro is changed to
use the getter, so all the call sites of the macro that are used as a setter
are changed to use the setter method directly. The next patch will remove the
macro completely.
Change-Id: I85ce24d847763badd34fdee3e14b8c8c14cb3161
Diffstat (limited to 'gdb/ctfread.c')
-rw-r--r-- | gdb/ctfread.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gdb/ctfread.c b/gdb/ctfread.c index 9436ce5..b37030b 100644 --- a/gdb/ctfread.c +++ b/gdb/ctfread.c @@ -698,7 +698,7 @@ read_func_kind_type (struct ctf_context *ccp, ctf_id_t tid) fname == nullptr ? "noname" : fname); } rettype = fetch_tid_type (ccp, cfi.ctc_return); - TYPE_TARGET_TYPE (type) = rettype; + type->set_target_type (rettype); set_type_align (type, ctf_type_align (fp, tid)); /* Set up function's arguments. */ @@ -749,7 +749,7 @@ read_enum_type (struct ctf_context *ccp, ctf_id_t tid) type->set_code (TYPE_CODE_ENUM); TYPE_LENGTH (type) = ctf_type_size (fp, tid); /* Set the underlying type based on its ctf_type_size bits. */ - TYPE_TARGET_TYPE (type) = objfile_int_type (of, TYPE_LENGTH (type), false); + type->set_target_type (objfile_int_type (of, TYPE_LENGTH (type), false)); set_type_align (type, ctf_type_align (fp, tid)); return set_tid_type (of, tid, type); @@ -791,15 +791,14 @@ add_array_cv_type (struct ctf_context *ccp, while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY) { - TYPE_TARGET_TYPE (inner_array) - = copy_type (TYPE_TARGET_TYPE (inner_array)); + inner_array->set_target_type (copy_type (TYPE_TARGET_TYPE (inner_array))); inner_array = TYPE_TARGET_TYPE (inner_array); } el_type = TYPE_TARGET_TYPE (inner_array); cnst |= TYPE_CONST (el_type); voltl |= TYPE_VOLATILE (el_type); - TYPE_TARGET_TYPE (inner_array) = make_cv_type (cnst, voltl, el_type, nullptr); + inner_array->set_target_type (make_cv_type (cnst, voltl, el_type, nullptr)); return set_tid_type (ccp->of, tid, base_type); } @@ -933,9 +932,9 @@ read_typedef_type (struct ctf_context *ccp, ctf_id_t tid, set_tid_type (objfile, tid, this_type); target_type = fetch_tid_type (ccp, btid); if (target_type != this_type) - TYPE_TARGET_TYPE (this_type) = target_type; + this_type->set_target_type (target_type); else - TYPE_TARGET_TYPE (this_type) = nullptr; + this_type->set_target_type (nullptr); this_type->set_target_is_stub (TYPE_TARGET_TYPE (this_type) != nullptr); |