return fn;
}
-/* Identify address space identifier by name --
- return the integer flag defined in gdbtypes.h. */
+/* Identify address space identifier by name -- return a
+ type_instance_flags. */
type_instance_flags
-address_space_name_to_int (struct gdbarch *gdbarch,
- const char *space_identifier)
+address_space_name_to_type_instance_flags (struct gdbarch *gdbarch,
+ const char *space_identifier)
{
type_instance_flags type_flags;
error (_("Unknown address space specifier: \"%s\""), space_identifier);
}
-/* Identify address space identifier by integer flag as defined in
- gdbtypes.h -- return the string version of the adress space name. */
+/* Identify address space identifier by type_instance_flags and return
+ the string version of the adress space name. */
const char *
-address_space_int_to_name (struct gdbarch *gdbarch,
- type_instance_flags space_flag)
+address_space_type_instance_flags_to_name (struct gdbarch *gdbarch,
+ type_instance_flags space_flag)
{
if (space_flag & TYPE_INSTANCE_FLAG_CODE_SPACE)
return "code";
ntype = type;
do
{
- if (TYPE_INSTANCE_FLAGS (ntype) == new_flags)
+ if (ntype->instance_flags () == new_flags)
return ntype;
ntype = TYPE_CHAIN (ntype);
}
make_restrict_type (struct type *type)
{
return make_qualified_type (type,
- (TYPE_INSTANCE_FLAGS (type)
+ (type->instance_flags ()
| TYPE_INSTANCE_FLAG_RESTRICT),
NULL);
}
make_unqualified_type (struct type *type)
{
return make_qualified_type (type,
- (TYPE_INSTANCE_FLAGS (type)
+ (type->instance_flags ()
& ~(TYPE_INSTANCE_FLAG_CONST
| TYPE_INSTANCE_FLAG_VOLATILE
| TYPE_INSTANCE_FLAG_RESTRICT)),
make_atomic_type (struct type *type)
{
return make_qualified_type (type,
- (TYPE_INSTANCE_FLAGS (type)
+ (type->instance_flags ()
| TYPE_INSTANCE_FLAG_ATOMIC),
NULL);
}
/* Assert that the two types have equivalent instance qualifiers.
This should be true for at least all of our debug readers. */
- gdb_assert (TYPE_INSTANCE_FLAGS (ntype) == TYPE_INSTANCE_FLAGS (type));
+ gdb_assert (ntype->instance_flags () == type->instance_flags ());
}
/* Implement direct support for MEMBER_TYPE in GNU C++.
result_type->set_bounds (bounds);
+ /* Note that the signed-ness of a range type can't simply be copied
+ from the underlying type. Consider a case where the underlying
+ type is 'int', but the range type can hold 0..65535, and where
+ the range is further specified to fit into 16 bits. In this
+ case, if we copy the underlying type's sign, then reading some
+ range values will cause an unwanted sign extension. So, we have
+ some heuristics here instead. */
if (low_bound->kind () == PROP_CONST && low_bound->const_val () >= 0)
result_type->set_is_unsigned (true);
-
/* Ada allows the declaration of range types whose upper bound is
less than the lower bound, so checking the lower bound is not
enough. Make sure we do not mark a range type whose upper bound
move over any other types NEWTYPE refers to, which could
be an unbounded amount of stuff. */
if (TYPE_OBJFILE (newtype) == TYPE_OBJFILE (type))
- type = make_qualified_type (newtype,
- TYPE_INSTANCE_FLAGS (type),
- type);
+ type = make_qualified_type (newtype, type->instance_flags (), type);
else
type = newtype;
}
with the complete type only if they are in the same
objfile. */
if (TYPE_OBJFILE (SYMBOL_TYPE (sym)) == TYPE_OBJFILE (type))
- type = make_qualified_type (SYMBOL_TYPE (sym),
- TYPE_INSTANCE_FLAGS (type),
- type);
+ type = make_qualified_type (SYMBOL_TYPE (sym),
+ type->instance_flags (), type);
else
type = SYMBOL_TYPE (sym);
}
if (unsigned_p)
t->set_is_unsigned (true);
+ TYPE_SPECIFIC_FIELD (t) = TYPE_SPECIFIC_INT;
+ TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_size = bit;
+ TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_offset = 0;
+
return t;
}
if (unsigned_p)
t->set_is_unsigned (true);
+ TYPE_SPECIFIC_FIELD (t) = TYPE_SPECIFIC_INT;
+ TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_size = bit;
+ TYPE_MAIN_TYPE (t)->type_specific.int_stuff.bit_offset = 0;
+
return t;
}
if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr)
{
- if (name == nullptr)
+ if (name == nullptr && target_type->name () != nullptr)
{
char *new_name
= (char *) TYPE_ALLOC (target_type,
|| type1->has_varargs () != type2->has_varargs ()
|| type1->is_vector () != type2->is_vector ()
|| TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2)
- || TYPE_INSTANCE_FLAGS (type1) != TYPE_INSTANCE_FLAGS (type2)
+ || type1->instance_flags () != type2->instance_flags ()
|| type1->num_fields () != type2->num_fields ())
return false;
gdb_print_host_address (TYPE_SELF_TYPE (type), gdb_stdout);
puts_filtered ("\n");
break;
+
+ case TYPE_SPECIFIC_INT:
+ if (type->bit_size_differs_p ())
+ {
+ unsigned bit_size = type->bit_size ();
+ unsigned bit_off = type->bit_offset ();
+ printfi_filtered (spaces, " bit size = %u, bit offset = %u\n",
+ bit_size, bit_off);
+ }
+ break;
}
if (spaces == 0)
types without duplicates. We use OBJFILE's obstack, because
OBJFILE is about to be deleted. */
-htab_t
+htab_up
create_copied_types_hash (struct objfile *objfile)
{
- return htab_create_alloc_ex (1, type_pair_hash, type_pair_eq,
- NULL, &objfile->objfile_obstack,
- hashtab_obstack_allocate,
- dummy_obstack_deallocate);
+ return htab_up (htab_create_alloc_ex (1, type_pair_hash, type_pair_eq,
+ NULL, &objfile->objfile_obstack,
+ hashtab_obstack_allocate,
+ dummy_obstack_deallocate));
}
/* Recursively copy (deep copy) a dynamic attribute list of a type. */
copy_type_recursive (objfile, TYPE_SELF_TYPE (type),
copied_types));
break;
+ case TYPE_SPECIFIC_INT:
+ TYPE_SPECIFIC_FIELD (new_type) = TYPE_SPECIFIC_INT;
+ TYPE_MAIN_TYPE (new_type)->type_specific.int_stuff
+ = TYPE_MAIN_TYPE (type)->type_specific.int_stuff;
+ break;
+
default:
gdb_assert_not_reached ("bad type_specific_kind");
}