From: Trevor Saunders Date: Wed, 13 Jul 2016 02:43:10 +0000 (+0000) Subject: tree.c: add [cd]tors to free_lang_data_d X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=74ea4cd5e3ecffdfbd50e2a03eac903d1c46900c;p=gcc.git tree.c: add [cd]tors to free_lang_data_d gcc/ChangeLog: 2016-07-12 Trevor Saunders * tree.c (struct free_lang_data_d): Add constructor and change types of members to ones that automatically manage resources. (fld_worklist_push): Adjust. (find_decls_types): Likewise. (find_decls_types_in_eh_region): Likewise. (free_lang_data_in_cgraph): Stop manually creating and destroying members of free_lang_data_d. From-SVN: r238278 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b7518f24b1..6ab7475a879 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2016-07-12 Trevor Saunders + + * tree.c (struct free_lang_data_d): Add constructor and change + types of members to ones that automatically manage resources. + (fld_worklist_push): Adjust. + (find_decls_types): Likewise. + (find_decls_types_in_eh_region): Likewise. + (free_lang_data_in_cgraph): Stop manually creating and + destroying members of free_lang_data_d. + 2016-07-13 Uros Bizjak PR rtl-optimization/68961 diff --git a/gcc/tree.c b/gcc/tree.c index 76842445924..ac3e3e93f5f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5500,17 +5500,19 @@ free_lang_data_in_decl (tree decl) struct free_lang_data_d { + free_lang_data_d () : decls (100), types (100) {} + /* Worklist to avoid excessive recursion. */ - vec worklist; + auto_vec worklist; /* Set of traversed objects. Used to avoid duplicate visits. */ - hash_set *pset; + hash_set pset; /* Array of symbols to process with free_lang_data_in_decl. */ - vec decls; + auto_vec decls; /* Array of types to process with free_lang_data_in_type. */ - vec types; + auto_vec types; }; @@ -5569,7 +5571,7 @@ add_tree_to_fld_list (tree t, struct free_lang_data_d *fld) static inline void fld_worklist_push (tree t, struct free_lang_data_d *fld) { - if (t && !is_lang_specific (t) && !fld->pset->contains (t)) + if (t && !is_lang_specific (t) && !fld->pset.contains (t)) fld->worklist.safe_push ((t)); } @@ -5738,8 +5740,8 @@ find_decls_types (tree t, struct free_lang_data_d *fld) { while (1) { - if (!fld->pset->contains (t)) - walk_tree (&t, find_decls_types_r, fld, fld->pset); + if (!fld->pset.contains (t)) + walk_tree (&t, find_decls_types_r, fld, &fld->pset); if (fld->worklist.is_empty ()) break; t = fld->worklist.pop (); @@ -5793,7 +5795,7 @@ find_decls_types_in_eh_region (eh_region r, struct free_lang_data_d *fld) for (c = r->u.eh_try.first_catch; c ; c = c->next_catch) { c->type_list = get_eh_types_for_runtime (c->type_list); - walk_tree (&c->type_list, find_decls_types_r, fld, fld->pset); + walk_tree (&c->type_list, find_decls_types_r, fld, &fld->pset); } } break; @@ -5801,12 +5803,12 @@ find_decls_types_in_eh_region (eh_region r, struct free_lang_data_d *fld) case ERT_ALLOWED_EXCEPTIONS: r->u.allowed.type_list = get_eh_types_for_runtime (r->u.allowed.type_list); - walk_tree (&r->u.allowed.type_list, find_decls_types_r, fld, fld->pset); + walk_tree (&r->u.allowed.type_list, find_decls_types_r, fld, &fld->pset); break; case ERT_MUST_NOT_THROW: walk_tree (&r->u.must_not_throw.failure_decl, - find_decls_types_r, fld, fld->pset); + find_decls_types_r, fld, &fld->pset); break; } } @@ -5948,12 +5950,6 @@ free_lang_data_in_cgraph (void) unsigned i; alias_pair *p; - /* Initialize sets and arrays to store referenced decls and types. */ - fld.pset = new hash_set; - fld.worklist.create (0); - fld.decls.create (100); - fld.types.create (100); - /* Find decls and types in the body of every function in the callgraph. */ FOR_EACH_FUNCTION (n) find_decls_types_in_node (n, &fld); @@ -5983,11 +5979,6 @@ free_lang_data_in_cgraph (void) FOR_EACH_VEC_ELT (fld.types, i, t) verify_type (t); } - - delete fld.pset; - fld.worklist.release (); - fld.decls.release (); - fld.types.release (); }