gdbtypes.h: Get rid of the TYPE_FIXED_POINT_INFO macro

This is one step further towards the removal of all these macros.

gdb/ChangeLog:

        * gdbtypes.h (struct type) <fixed_point_info, set_fixed_point_info>:
        New methods.
        (INIT_FIXED_POINT_SPECIFIC): Adjust.
        (TYPE_FIXED_POINT_INFO): Delete macro.
        (allocate_fixed_point_type_info): Change return type to void.
        * gdbtypes.c (copy_type_recursive): Replace the use of
        TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method.
        (fixed_point_scaling_factor): Likewise.
        (allocate_fixed_point_type_info): Change return type to void.
        Adjust implementation accordingly.
        * dwarf2/read.c (finish_fixed_point_type): Replace the use of
        TYPE_FIXED_POINT_INFO by a call to the fixed_point_info method.
This commit is contained in:
Joel Brobecker
2020-11-23 21:47:40 -05:00
parent c9f0b43fe4
commit 2a12c336b9
4 changed files with 48 additions and 16 deletions

View File

@ -5503,8 +5503,8 @@ copy_type_recursive (struct objfile *objfile,
break;
case TYPE_SPECIFIC_FIXED_POINT:
INIT_FIXED_POINT_SPECIFIC (new_type);
TYPE_FIXED_POINT_INFO (new_type)->scaling_factor
= TYPE_FIXED_POINT_INFO (type)->scaling_factor;
new_type->fixed_point_info ().scaling_factor
= type->fixed_point_info ().scaling_factor;
break;
case TYPE_SPECIFIC_INT:
TYPE_SPECIFIC_FIELD (new_type) = TYPE_SPECIFIC_INT;
@ -5826,11 +5826,11 @@ static const struct objfile_key<fixed_point_type_storage>
/* See gdbtypes.h. */
fixed_point_type_info *
void
allocate_fixed_point_type_info (struct type *type)
{
std::unique_ptr<fixed_point_type_info> up (new fixed_point_type_info);
fixed_point_type_info *result;
fixed_point_type_info *info;
if (TYPE_OBJFILE_OWNED (type))
{
@ -5838,17 +5838,17 @@ allocate_fixed_point_type_info (struct type *type)
= fixed_point_objfile_key.get (TYPE_OBJFILE (type));
if (storage == nullptr)
storage = fixed_point_objfile_key.emplace (TYPE_OBJFILE (type));
result = up.get ();
info = up.get ();
storage->push_back (std::move (up));
}
else
{
/* We just leak the memory, because that's what we do generally
for non-objfile-attached types. */
result = up.release ();
info = up.release ();
}
return result;
type->set_fixed_point_info (info);
}
/* See gdbtypes.h. */
@ -5883,7 +5883,7 @@ fixed_point_scaling_factor (struct type *type)
{
type = fixed_point_type_base_type (type);
return TYPE_FIXED_POINT_INFO (type)->scaling_factor;
return type->fixed_point_info ().scaling_factor;
}