binutils-gdb/gdb/unittests
Pedro Alves 6b1747cd13 invoke_xmethod & array_view
This replaces more pointer+length with gdb::array_view.  This time,
around invoke_xmethod, and then propagating the fallout around, which
inevitably leaks to the overload resolution code.

There are several places in the code that want to grab a slice of an
array, by advancing the array pointer, and decreasing the length
pointer.  This patch introduces a pair of new
gdb::array_view::slice(...) methods to make that convenient and clear.
Unit test included.

gdb/ChangeLog:
2018-11-21  Pedro Alves  <palves@redhat.com>

	* common/array-view.h (array_view::splice(size_type, size_t)): New.
	(array_view::splice(size_type)): New.
	* eval.c (eval_call, evaluate_funcall): Adjust to use array_view.
	* extension.c (xmethod_worker::get_arg_types): Adjust to return an
	std::vector.
	(xmethod_worker::get_result_type): Adjust to use gdb::array_view.
	* extension.h: Include "common/array-view.h".
	(xmethod_worker::invoke): Adjust to use gdb::array_view.
	(xmethod_worker::get_arg_types): Adjust to return an std::vector.
	(xmethod_worker::get_result_type): Adjust to use gdb::array_view.
	(xmethod_worker::do_get_arg_types): Adjust to use std::vector.
	(xmethod_worker::do_get_result_type): Adjust to use
	gdb::array_view.
	* gdbtypes.c (rank_function): Adjust to use gdb::array_view.
	* gdbtypes.h: Include "common/array-view.h".
	(rank_function): Adjust to use gdb::array_view.
	* python/py-xmethods.c (python_xmethod_worker::invoke)
	(python_xmethod_worker::do_get_arg_types)
	(python_xmethod_worker::do_get_result_type)
	(python_xmethod_worker::invoke): Adjust to new interfaces.
	* valarith.c (value_user_defined_cpp_op, value_user_defined_op)
	(value_x_binop, value_x_unop): Adjust to use gdb::array_view.
	* valops.c (find_overload_match, find_oload_champ_namespace)
	(find_oload_champ_namespace_loop, find_oload_champ): Adjust to use
	gdb:array_view and the new xmethod_worker interfaces.
	* value.c (result_type_of_xmethod, call_xmethod): Adjust to use
	gdb::array_view.
	* value.h (find_overload_match, result_type_of_xmethod)
	(call_xmethod): Adjust to use gdb::array_view.
	* unittests/array-view-selftests.c: Add slicing tests.
2018-11-21 12:06:20 +00:00
..
basic_string_view Simple unused variable removals 2018-07-22 13:20:01 -06:00
optional Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
array-view-selftests.c invoke_xmethod & array_view 2018-11-21 12:06:20 +00:00
cli-utils-selftests.c Add a self-test for cli-utils.c 2018-07-12 23:10:56 +02:00
common-utils-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
copy_bitwise-selftests.c Move copy_bitwise unittests to own unittest file 2018-11-15 10:53:57 -05:00
environ-selftests.c Move gdb/common/diagnostics.h to include/diagnostics.h 2018-06-01 09:40:30 -07:00
format_pieces-selftests.c format_pieces-selftests.c: Silence ARI warnings 2018-05-18 15:47:56 -04:00
function-view-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
lookup_name_info-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
memory-map-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
memrange-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
mkdir-recursive-selftests.c Import mkdtemp gnulib module, fix mingw build 2018-11-01 15:41:43 -04:00
observable-selftests.c Convert observers to C++ 2018-03-19 09:37:49 -06:00
offset-type-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
optional-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
parse-connection-spec-selftests.c Implement IPv6 support for GDB/gdbserver 2018-07-11 19:41:31 -04:00
ptid-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
rsp-low-selftests.c Get rid of VEC(static_tracepoint_marker_p) 2018-03-22 00:27:19 -04:00
scoped_fd-selftests.c Do not reopen temporary files 2018-10-27 11:58:41 -06:00
scoped_mmap-selftests.c Use mkostemp, not mkstemp 2018-10-27 11:58:41 -06:00
scoped_restore-selftests.c Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
string_view-selftests.c Define GNULIB_NAMESPACE in unittests/string_view-selftests.c 2018-05-08 16:45:02 -04:00
tracepoint-selftests.c Get rid of VEC(static_tracepoint_marker_p) 2018-03-22 00:27:19 -04:00
unpack-selftests.c Sign-extend non-bit-fields in unpack_bits_as_long 2018-02-26 09:21:08 -07:00
utils-selftests.c Add selftest for substitute_path_component 2018-03-15 22:04:42 -04:00
xml-utils-selftests.c Add xml_escape_text_append and use it 2018-03-08 18:04:46 -05:00