Introduce type::is_array_like and value_to_array

This adds the type::is_array_like method and the value_to_array
function.

The former can be used to see whether a given type is known to be
"array-like".  This is the currently the case for certain
compiler-generated structure types; in particular both the Ada and
Rust compilers do this.
This commit is contained in:
Tom Tromey
2023-08-07 06:35:51 -06:00
parent cf1eca3cbb
commit 84914f598e
4 changed files with 46 additions and 0 deletions

View File

@@ -1430,6 +1430,11 @@ struct type
return this->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (this);
}
/* Return true if this type is "array-like". This includes arrays,
but also some forms of structure type that are recognized as
representations of arrays by the type's language. */
bool is_array_like ();
/* * Type that is a pointer to this type.
NULL if no such pointer-to type is known yet.
The debugger may add the address of such a type