diff options
author | Nathan Froyd <froydnj@codesourcery.com> | 2011-05-27 17:43:44 +0000 |
---|---|---|
committer | Nathan Froyd <froydnj@gcc.gnu.org> | 2011-05-27 17:43:44 +0000 |
commit | 38e01f9ec96801f325e382746ba2d424adea5eee (patch) | |
tree | 308837cc489c3a37ca81ae52d342d7b9bd43b7c7 /gcc/tree-iterator.c | |
parent | e330aa5b3568877fb26267fa0f277de320821b14 (diff) | |
download | gcc-38e01f9ec96801f325e382746ba2d424adea5eee.zip gcc-38e01f9ec96801f325e382746ba2d424adea5eee.tar.gz gcc-38e01f9ec96801f325e382746ba2d424adea5eee.tar.bz2 |
move TS_STATEMENT_LIST to be a substructure of TS_TYPED
move TS_STATEMENT_LIST to be a substructure of TS_TYPED
gcc/
* c-decl.c (c_push_function_context): Copy the current statement
list stack.
(add_stmt): Check building_stmt_list_p and push_stmt if necessary.
(finish_struct): Call building_stmt_list_p instead of checking
cur_stmt_list.
* c-parser.c (c_parser_postfix_expression): Likewise.
* c-typeck.c (c_end_compound_stmt): Likewise.
* print-tree.c (print_node) [STATEMENT_LIST]: Don't print TREE_CHAIN.
* tree-iterator.c (stmt_list_cache): Change to a VEC.
(alloc_stmt_list): Adjust for stmt_list_cache's new type.
(free_stmt_list): Likewise.
* tree.h (struct tree_statement_list): Include typed_tree instead
of tree_common.
* tree.c (initialize_tree_contains_struct): Mark TS_STATEMENT_LIST
as TS_TYPED instead of TS_COMMON.
gcc/c-family/
* c-common.h (struct stmt_tree_s) [x_cur_stmt_list]: Change to a VEC.
(stmt_list_stack): Define.
(cur_stmt_list): Adjust for new type of x_cur_stmt_list.
* c-semantics.c (push_stmt_list, pop_stmt_list): Likewise.
gcc/cp/
* cp-tree.h (building_stmt_tree): Delete.
* decl.c (save_function_data): Tweak initializer for x_cur_stmt_list.
(build_aggr_init_full_exprs): Call building_stmt_list_p
instead of building_stmt_tree.
(initialize_local_var): Likewise.
(finish_function): Likewise.
* decl2.c (finish_anon_union): Likewise.
* init.c (begin_init_stmts): Likewise.
(finish_init_stmts): Likewise.
(expand_aggr_init_1): Likewise.
* name-lookup.c (do_local_using_decl): Likewise.
(do_namespace_alias): Likewise.
(do_using_directive): Likewise.
(cp_emit_debug_info_for_using): Likewise.
* semantics.c (add_stmt): Assert that stmt_list_stack is non-empty.
From-SVN: r174343
Diffstat (limited to 'gcc/tree-iterator.c')
-rw-r--r-- | gcc/tree-iterator.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/gcc/tree-iterator.c b/gcc/tree-iterator.c index 05764da..44b6bed 100644 --- a/gcc/tree-iterator.c +++ b/gcc/tree-iterator.c @@ -31,17 +31,16 @@ along with GCC; see the file COPYING3. If not see /* This is a cache of STATEMENT_LIST nodes. We create and destroy them fairly often during gimplification. */ -static GTY ((deletable (""))) tree stmt_list_cache; +static GTY ((deletable (""))) VEC(tree,gc) *stmt_list_cache; tree alloc_stmt_list (void) { - tree list = stmt_list_cache; - if (list) + tree list; + if (!VEC_empty (tree, stmt_list_cache)) { - stmt_list_cache = TREE_CHAIN (list); - gcc_assert (stmt_list_cache != list); - memset (list, 0, sizeof(struct tree_common)); + list = VEC_pop (tree, stmt_list_cache); + memset (list, 0, sizeof(struct tree_base)); TREE_SET_CODE (list, STATEMENT_LIST); } else @@ -55,11 +54,7 @@ free_stmt_list (tree t) { gcc_assert (!STATEMENT_LIST_HEAD (t)); gcc_assert (!STATEMENT_LIST_TAIL (t)); - /* If this triggers, it's a sign that the same list is being freed - twice. */ - gcc_assert (t != stmt_list_cache || stmt_list_cache == NULL); - TREE_CHAIN (t) = stmt_list_cache; - stmt_list_cache = t; + VEC_safe_push (tree, gc, stmt_list_cache, t); } /* A subroutine of append_to_statement_list{,_force}. T is not NULL. */ |