]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb: introduce new function create_function_type
authorJan Vrany <jan.vrany@labware.com>
Fri, 10 Oct 2025 20:38:44 +0000 (21:38 +0100)
committerJan Vrany <jan.vrany@labware.com>
Fri, 10 Oct 2025 20:38:44 +0000 (21:38 +0100)
commit5aff8911350d265c33bb98be1f69095ba16fa76d
tree602ecfbfc20aeb66a50fccddffebc1982bdd6ed5
parent1ff5a447620050135b6431c761a5f2d8b01519fe
gdb: introduce new function create_function_type

While working on new Python API to create new function types I realized
that there's no easy way to create a new function type and control where
it is going to be allocated (whether in gdbarch's obstack or objfile's).
Functions lookup_function_type and lookup_function_type_with_arguments
always allocate at the same obstack as its return type.

This is not sufficient for the new Python API - the user may use any
type it can get hold of. For example, one may want to create a function
returning arch-owned type and taking one argument of objfile-owned type.
In that case we need to allocate the new type on that very objfile's
obstack.

This commit introduces new function - create_function_type - that takes
type_allocator as first parameter, allowing caller to control the
allocation. Existing functions (lookup_function_type and
lookup_function_type_with_arguments) are reimplemented by means of new
create_function_type.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/gdbtypes.c
gdb/gdbtypes.h