From 0891c3cc132495ad7b323896efae4f91eca87c6c Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 21 Nov 2018 11:55:13 +0000 Subject: Eliminate make_symbol_overload_list-related globals & cleanup This gets rid of a few globals and a cleanup. make_symbol_overload_list & friends currently maintain a global open-coded vector. Reimplement that with a std::vector, trickled down through the functions. Rename a few functions from "make_" to "add_" for clarity. gdb/ChangeLog: 2018-11-21 Pedro Alves * cp-support.c (sym_return_val_size, sym_return_val_index) (sym_return_val): Delete. (overload_list_add_symbol): Add std::vector parameter. Adjust to add to the vector. (make_symbol_overload_list): Adjust to return a std::vector instead of maintaining a global open coded vector. (make_symbol_overload_list_block): Add std::vector parameter. (make_symbol_overload_list_block): Rename to ... (add_symbol_overload_list_block): ... this and add std::vector parameter. (make_symbol_overload_list_namespace): Rename to ... (add_symbol_overload_list_namespace): ... this and add std::vector parameter. (make_symbol_overload_list_adl_namespace): Rename to ... (add_symbol_overload_list_adl_namespace): ... this and add std::vector parameter. (make_symbol_overload_list_adl): Delete. (add_symbol_overload_list_adl): New. (make_symbol_overload_list_using): Rename to ... (add_symbol_overload_list_using): ... this and add std::vector parameter. (make_symbol_overload_list_qualified): Rename to ... (add_symbol_overload_list_qualified): ... this and add std::vector parameter. * cp-support.h: Include "common/array-view.h" and . (make_symbol_overload_list): Change return type to std::vector. (make_symbol_overload_list_adl): Delete declaration. (add_symbol_overload_list_adl): New declaration. * valops.c (find_overload_match): Local 'oload_syms' now a std::vector. (find_oload_champ_namespace): 'oload_syms' parameter now a std::vector pointer. (find_oload_champ_namespace_loop): 'oload_syms' parameter now a std::vector pointer. Adjust to new make_symbol_overload_list interface. --- gdb/cp-support.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'gdb/cp-support.h') diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 4e26921..0402df0 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -28,6 +28,8 @@ #include "vec.h" #include "gdb_vecs.h" #include "gdb_obstack.h" +#include "common/array-view.h" +#include /* Opaque declarations. */ @@ -107,12 +109,13 @@ extern gdb::unique_xmalloc_ptr cp_remove_params extern gdb::unique_xmalloc_ptr cp_remove_params_if_any (const char *demangled_name, bool completion_mode); -extern struct symbol **make_symbol_overload_list (const char *, - const char *); +extern std::vector make_symbol_overload_list (const char *, + const char *); -extern struct symbol **make_symbol_overload_list_adl (struct type **arg_types, - int nargs, - const char *func_name); +extern void add_symbol_overload_list_adl + (gdb::array_view arg_types, + const char *func_name, + std::vector *overload_list); extern struct type *cp_lookup_rtti_type (const char *name, struct block *block); -- cgit v1.1