From 4c39bc03545798694b4ed2a5cd5caedd7ce3cc50 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 14 Oct 2018 12:18:21 -0600 Subject: [PATCH] Remove DEF_VECs from symtab.h This removes a couple of DEF_VECs from symtab.h, replacing them with std::vector at the points of use. gdb/ChangeLog 2018-10-26 Tom Tromey * dwarf2read.c (recursively_compute_inclusions): Use std::vector. (compute_compunit_symtab_includes): Update. * symtab.h: (symtab_ptr): Remove typedef. Don't define a VEC. (compunit_symtab_ptr): Likewise. --- gdb/ChangeLog | 7 +++++++ gdb/dwarf2read.c | 19 +++++++------------ gdb/symtab.h | 6 ------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a8d15aa..1f8e958 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2018-10-26 Tom Tromey + + * dwarf2read.c (recursively_compute_inclusions): Use std::vector. + (compute_compunit_symtab_includes): Update. + * symtab.h: (symtab_ptr): Remove typedef. Don't define a VEC. + (compunit_symtab_ptr): Likewise. + 2018-10-26 John Baldwin * fbsd-tdep.c (fbsd_print_auxv_entry): Only use diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 2a1b805..1b4f966 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -10210,7 +10210,7 @@ get_compunit_symtab (struct dwarf2_per_cu_data *per_cu) included by PER_CU. */ static void -recursively_compute_inclusions (VEC (compunit_symtab_ptr) **result, +recursively_compute_inclusions (std::vector *result, htab_t all_children, htab_t all_type_symtabs, struct dwarf2_per_cu_data *per_cu, struct compunit_symtab *immediate_parent) @@ -10240,14 +10240,14 @@ recursively_compute_inclusions (VEC (compunit_symtab_ptr) **result, if (*slot == NULL) { *slot = cust; - VEC_safe_push (compunit_symtab_ptr, *result, cust); + result->push_back (cust); if (cust->user == NULL) cust->user = immediate_parent; } } else { - VEC_safe_push (compunit_symtab_ptr, *result, cust); + result->push_back (cust); if (cust->user == NULL) cust->user = immediate_parent; } @@ -10274,8 +10274,7 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu) { int ix, len; struct dwarf2_per_cu_data *per_cu_iter; - struct compunit_symtab *compunit_symtab_iter; - VEC (compunit_symtab_ptr) *result_symtabs = NULL; + std::vector result_symtabs; htab_t all_children, all_type_symtabs; struct compunit_symtab *cust = get_compunit_symtab (per_cu); @@ -10299,18 +10298,14 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu) } /* Now we have a transitive closure of all the included symtabs. */ - len = VEC_length (compunit_symtab_ptr, result_symtabs); + len = result_symtabs.size (); cust->includes = XOBNEWVEC (&per_cu->dwarf2_per_objfile->objfile->objfile_obstack, struct compunit_symtab *, len + 1); - for (ix = 0; - VEC_iterate (compunit_symtab_ptr, result_symtabs, ix, - compunit_symtab_iter); - ++ix) - cust->includes[ix] = compunit_symtab_iter; + memcpy (cust->includes, result_symtabs.data (), + len * sizeof (compunit_symtab *)); cust->includes[len] = NULL; - VEC_free (compunit_symtab_ptr, result_symtabs); htab_delete (all_children); htab_delete (all_type_symtabs); } diff --git a/gdb/symtab.h b/gdb/symtab.h index 399666b..b91ec12 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1357,9 +1357,6 @@ struct symtab #define SYMTAB_DIRNAME(symtab) \ COMPUNIT_DIRNAME (SYMTAB_COMPUNIT (symtab)) -typedef struct symtab *symtab_ptr; -DEF_VEC_P (symtab_ptr); - /* Compunit symtabs contain the actual "symbol table", aka blockvector, as well as the list of all source files (what gdb has historically associated with the term "symtab"). @@ -1501,9 +1498,6 @@ extern struct symtab * extern enum language compunit_language (const struct compunit_symtab *cust); -typedef struct compunit_symtab *compunit_symtab_ptr; -DEF_VEC_P (compunit_symtab_ptr); - /* The virtual function table is now an array of structures which have the -- 2.7.4