Re: [PATCH 06/16] gdb: split make_type_with_address_space

Tom Tromey <[email protected]> Tue, 21 Jul 2026 12:49:34 -0600
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
>>>>> Tankut Baris Aktemur <[email protected]> writes:

> The function make_type_with_address_space is used for creating a type
> variant with a particular Harvard address space or an address class
> id.  The argument is type instance flags.  Split the function into
> two, each doing one task: (1) making a type variant with a given
> Harvard address space id, and (2) making a type variant with a given
> address class id.  This is a step towards making function signatures
> clearer and more descriptive.

A couple minor nits for this one.

> +make_type_with_harvard_address_space (struct type *type,
> +				      enum harvard_address_space aspace)
> +{
> +  type_instance_flags new_flags
> +    = (enum type_instance_flag_value) (aspace << 2);
> +
> +  gdb_assert ((new_flags & ~(TYPE_INSTANCE_FLAG_CODE_SPACE
> +			     | TYPE_INSTANCE_FLAG_DATA_SPACE)) == 0);
> +  new_flags |= (type->instance_flags ()
> +		& ~(TYPE_INSTANCE_FLAG_CODE_SPACE
> +		    | TYPE_INSTANCE_FLAG_DATA_SPACE));
> +
> +  return make_qualified_type (type, new_flags, NULL);

Could you use nullptr here?

 
> +enum harvard_address_space
> +{
> +  HARVARD_ASPACE_NONE = 0,
> +  HARVARD_ASPACE_CODE = 1,
> +  HARVARD_ASPACE_DATA = 2,
> +};

This could use some kind of comment.

Tom