language_lookup_primitive_type, std::function -> gdb::function_view

gdb/ChangeLog:

	* language.c (language_arch_info::lookup_primitive_type): Use
	gdb::function_view instead of gdb::function.
	(template language_lookup_primitive_type): Rename to ...
	(language_lookup_primitive_type_1): ... this, and make static.
	(language_lookup_primitive_type(const struct language_defn *,
	struct gdbarch *, const char *): Make non-template.
	(language_lookup_primitive_type(const struct language_defn *,
	struct gdbarch *, std::function<bool (struct type *)>): Make
	non-template and use gdb::function_view.
	* language.h (language_arch_info::lookup_primitive_type): Use
	gdb::function_view instead of std::function.
	(language_lookup_primitive_type): No longer template.
	* opencl-lang.c (lookup_opencl_vector_type): 'filter' is now a
	lambda instead of a std::function.
This commit is contained in:
Pedro Alves 2020-11-16 19:15:00 +00:00
parent e6f6aa8d18
commit cbbcd7a716
4 changed files with 55 additions and 20 deletions

View file

@ -46,7 +46,7 @@ lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code,
/* Triple vectors have the size of a quad vector. */
length = (n == 3) ? el_length * 4 : el_length * n;
std::function<bool (struct type *)> filter = [&] (struct type *type)
auto filter = [&] (struct type *type)
{
LONGEST lowb, highb;