aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-07-30 12:07:39 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-09-21 10:53:55 -0400
commit8a50fdcefc44c40d5c4b978f19c22ddfbeb29139 (patch)
tree423aae459c642ed5542af312098835612df0ec84 /gdb/ada-lang.c
parent0242db993f8ad0a0de16dafc4ebd35bb6190c833 (diff)
downloadbinutils-8a50fdcefc44c40d5c4b978f19c22ddfbeb29139.zip
binutils-8a50fdcefc44c40d5c4b978f19c22ddfbeb29139.tar.gz
binutils-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/ada-lang.c')
-rw-r--r--gdb/ada-lang.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index d49baf9..c5657d9 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8114,7 +8114,7 @@ template_to_static_fixed_type (struct type *type0)
/* Whether or not we cloned TYPE0, cache the result so that we don't do
recompute all over next time. */
- TYPE_TARGET_TYPE (type0) = type;
+ type0->set_target_type (type);
for (f = 0; f < nfields; f += 1)
{
@@ -8134,7 +8134,8 @@ template_to_static_fixed_type (struct type *type0)
/* Clone TYPE0 only the first time we get a new field type. */
if (type == type0)
{
- TYPE_TARGET_TYPE (type0) = type = alloc_type_copy (type0);
+ type = alloc_type_copy (type0);
+ type0->set_target_type (type);
type->set_code (type0->code ());
INIT_NONE_SPECIFIC (type);
type->set_num_fields (nfields);
@@ -10278,8 +10279,8 @@ ada_ternop_slice (struct expression *exp,
the aligners. */
if (value_type (array)->code () == TYPE_CODE_REF
&& ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array))))
- TYPE_TARGET_TYPE (value_type (array)) =
- ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)));
+ value_type (array)->set_target_type
+ (ada_aligned_type (TYPE_TARGET_TYPE (value_type (array))));
if (ada_is_any_packed_array_type (value_type (array)))
error (_("cannot slice a packed array"));