aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2021-07-13 14:42:09 -0400
committerJason Merrill <jason@redhat.com>2021-07-14 15:01:27 -0400
commit91bb571d200e551f427e337e00494e0b4f229876 (patch)
treeb72e29de68aa237224fbafabf8b0271734aa3fc4 /gcc
parentb15e301748f0e042379909e32b3ade439dd8f8f9 (diff)
downloadgcc-91bb571d200e551f427e337e00494e0b4f229876.zip
gcc-91bb571d200e551f427e337e00494e0b4f229876.tar.gz
gcc-91bb571d200e551f427e337e00494e0b4f229876.tar.bz2
vec: use auto_vec in a few more places
The uses of vec<T> in get_all_loop_exits and process_conditional were memory leaks, as .release() was never called for them. The other changes are some cases that did have proper release handling, but it's simpler to leave releasing to the auto_vec destructor. gcc/ChangeLog: * sel-sched-ir.h (get_all_loop_exits): Use auto_vec. gcc/cp/ChangeLog: * class.c (struct find_final_overrider_data): Use auto_vec. (find_final_overrider): Remove explicit release. * coroutines.cc (process_conditional): Use auto_vec. * cp-gimplify.c (struct cp_genericize_data): Use auto_vec. (cp_genericize_tree): Remove explicit release. * parser.c (cp_parser_objc_at_property_declaration): Use auto_delete_vec. * semantics.c (omp_reduction_lookup): Use auto_vec.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/coroutines.cc2
-rw-r--r--gcc/cp/cp-gimplify.c3
-rw-r--r--gcc/cp/parser.c6
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/sel-sched-ir.h2
6 files changed, 6 insertions, 14 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 33093e1..14db066 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2391,7 +2391,7 @@ struct find_final_overrider_data {
/* The candidate overriders. */
tree candidates;
/* Path to most derived. */
- vec<tree> path;
+ auto_vec<tree> path;
};
/* Add the overrider along the current path to FFOD->CANDIDATES.
@@ -2504,8 +2504,6 @@ find_final_overrider (tree derived, tree binfo, tree fn)
dfs_walk_all (derived, dfs_find_final_overrider_pre,
dfs_find_final_overrider_post, &ffod);
- ffod.path.release ();
-
/* If there was no winner, issue an error message. */
if (!ffod.candidates || TREE_CHAIN (ffod.candidates))
return error_mark_node;
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 54ffdc8..712a5c0 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -3081,7 +3081,7 @@ process_conditional (var_nest_node *n, tree& vlist)
{
tree init = n->init;
hash_map<tree, tree> var_flags;
- vec<tree> var_list = vNULL;
+ auto_vec<tree> var_list;
tree new_then = push_stmt_list ();
handle_nested_conditionals (n->then_cl, var_list, var_flags);
new_then = pop_stmt_list (new_then);
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 00b7772..de37f2c 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -807,7 +807,7 @@ omp_cxx_notice_variable (struct cp_genericize_omp_taskreg *omp_ctx, tree decl)
struct cp_genericize_data
{
hash_set<tree> *p_set;
- vec<tree> bind_expr_stack;
+ auto_vec<tree> bind_expr_stack;
struct cp_genericize_omp_taskreg *omp_ctx;
tree try_block;
bool no_sanitize_p;
@@ -1582,7 +1582,6 @@ cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p)
wtd.handle_invisiref_parm_p = handle_invisiref_parm_p;
cp_walk_tree (t_p, cp_genericize_r, &wtd, NULL);
delete wtd.p_set;
- wtd.bind_expr_stack.release ();
if (sanitize_flags_p (SANITIZE_VPTR))
cp_ubsan_instrument_member_accesses (t_p);
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 93698aa..821ce17 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -35247,7 +35247,7 @@ cp_parser_objc_at_property_declaration (cp_parser *parser)
/* Parse the optional attribute list.
A list of parsed, but not verified, attributes. */
- vec<property_attribute_info *> prop_attr_list = vNULL;
+ auto_delete_vec<property_attribute_info> prop_attr_list;
location_t loc = cp_lexer_peek_token (parser->lexer)->location;
cp_lexer_consume_token (parser->lexer); /* Eat '@property'. */
@@ -35423,10 +35423,6 @@ cp_parser_objc_at_property_declaration (cp_parser *parser)
}
cp_parser_consume_semicolon_at_end_of_statement (parser);
-
- while (!prop_attr_list.is_empty())
- delete prop_attr_list.pop ();
- prop_attr_list.release ();
}
/* Parse an Objective-C++ @synthesize declaration. The syntax is:
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index b080259..b97dc1f 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -5774,7 +5774,7 @@ omp_reduction_lookup (location_t loc, tree id, tree type, tree *baselinkp,
if (!id && CLASS_TYPE_P (type) && TYPE_BINFO (type))
{
- vec<tree> ambiguous = vNULL;
+ auto_vec<tree> ambiguous;
tree binfo = TYPE_BINFO (type), base_binfo, ret = NULL_TREE;
unsigned int ix;
if (ambiguousp == NULL)
@@ -5811,7 +5811,6 @@ omp_reduction_lookup (location_t loc, tree id, tree type, tree *baselinkp,
if (idx == 0)
str = get_spaces (str);
}
- ambiguous.release ();
ret = error_mark_node;
baselink = NULL_TREE;
}
diff --git a/gcc/sel-sched-ir.h b/gcc/sel-sched-ir.h
index 78b2566..8ee0529 100644
--- a/gcc/sel-sched-ir.h
+++ b/gcc/sel-sched-ir.h
@@ -1166,7 +1166,7 @@ get_all_loop_exits (basic_block bb)
|| (inner_loop_header_p (e->dest)))
&& loop_depth (e->dest->loop_father) >= this_depth)
{
- vec<edge> next_exits = get_all_loop_exits (e->dest);
+ auto_vec<edge> next_exits = get_all_loop_exits (e->dest);
if (next_exits.exists ())
{