Give a language to a type

This changes main_type to hold a language, and updates the debug
readers to set this field.  This is done by adding the language to the
type-allocator object.

Note that the non-DWARF readers are changed on a "best effort" basis.

This patch also reimplements type::is_array_like to use the type's
language, and it adds a new type::is_string_like as well.  This in
turn lets us change the Python implementation of these methods to
simply defer to the type.
This commit is contained in:
Tom Tromey
2023-09-05 12:29:23 -06:00
parent 26733fc747
commit 76fc0f6213
9 changed files with 98 additions and 94 deletions

View File

@ -354,7 +354,7 @@ coff_alloc_type (int index)
We will fill it in later if we find out how. */
if (type == NULL)
{
type = type_allocator (coffread_objfile).new_type ();
type = type_allocator (coffread_objfile, language_c).new_type ();
*type_addr = type;
}
return type;
@ -1763,7 +1763,7 @@ decode_type (struct coff_symbol *cs, unsigned int c_type,
base_type = decode_type (cs, new_c_type, aux, objfile);
index_type = builtin_type (objfile)->builtin_int;
type_allocator alloc (objfile);
type_allocator alloc (objfile, language_c);
range_type
= create_static_range_type (alloc, index_type, 0, n - 1);
type = create_array_type (alloc, base_type, range_type);