diff options
author | Richard Guenther <rguenther@suse.de> | 2010-09-16 09:38:13 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-09-16 09:38:13 +0000 |
commit | 6be14c0ebc4ba0c43a78a54254c89e07cb2cfc48 (patch) | |
tree | db74c86f639c1dd58991243eee16d61445974c50 /gcc/c-decl.c | |
parent | 0c3dbcf05753a1e3d817b77db96e87eab72c91f6 (diff) | |
download | gcc-6be14c0ebc4ba0c43a78a54254c89e07cb2cfc48.zip gcc-6be14c0ebc4ba0c43a78a54254c89e07cb2cfc48.tar.gz gcc-6be14c0ebc4ba0c43a78a54254c89e07cb2cfc48.tar.bz2 |
tree.c (tree_node_structure_for_code): TRANSLATION_UNIT_DECL is TS_TRANSLATION_UNIT_DECL.
2010-09-16 Richard Guenther <rguenther@suse.de>
* tree.c (tree_node_structure_for_code): TRANSLATION_UNIT_DECL
is TS_TRANSLATION_UNIT_DECL.
(initialize_tree_contains_struct): Adjust.
(all_translation_units): New global vector.
(build_translation_unit_decl): New function.
* tree.h (TRANSLATION_UNIT_LANGUAGE): New macro.
(struct tree_translation_unit_decl): New.
(all_translation_units): Declare.
(union tree_node): Add translation_unit_decl member.
(build_translation_unit_decl): Declare.
* treestruct.def (TS_TRANSLATION_UNIT_DECL): New.
* lto-streamer-out.c (pack_ts_translation_unit_decl_value_fields):
New function.
(pack_value_fields): Call it.
(lto_output_tree_ref): Handle references to TRANSLATION_UNIT_DECL.
(lto_output_ts_translation_unit_decl_tree_pointers): New function.
(lto_output_tree_pointers): Call it.
* lto-streamer-in.c (lto_input_tree_ref): Handle references
to TRANSLATION_UNIT_DECL.
(unpack_ts_translation_unit_decl_value_fields): New function.
(unpack_value_fields): Call it.
(lto_input_ts_translation_unit_decl_tree_pointers): New function.
(lto_input_tree_pointers): Call it.
* lto-streamer.c (check_handled_ts_structures): Adjust.
* lto-streamer.h (enum LTO_tags): Add LTO_translation_unit_decl_ref.
* c-decl.c (all_translation_units): Remove.
(pop_scope): Use build_translation_unit_decl.
(collect_all_refs): Adjust.
(for_each_global_decl): Likewise.
(c_write_global_declarations): Likewise.
java/
* jcf-parse.c (current_file_list): Remove.
(java_parse_file): Use build_translation_unit_decl. Adjust.
From-SVN: r164331
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 03836b5..6c65b27 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -118,12 +118,6 @@ static GTY(()) struct stmt_tree_s c_stmt_tree; tree c_break_label; tree c_cont_label; -/* Linked list of TRANSLATION_UNIT_DECLS for the translation units - included in this invocation. Note that the current translation - unit is not included in this list. */ - -static GTY(()) tree all_translation_units; - /* A list of decls to be made automatically visible in each file scope. */ static GTY(()) tree visible_builtins; @@ -1072,10 +1066,7 @@ pop_scope (void) context = current_function_decl; else if (scope == file_scope) { - tree file_decl = build_decl (UNKNOWN_LOCATION, - TRANSLATION_UNIT_DECL, 0, 0); - DECL_CHAIN (file_decl) = all_translation_units; - all_translation_units = file_decl; + tree file_decl = build_translation_unit_decl (NULL_TREE); context = file_decl; } else @@ -9664,8 +9655,9 @@ static void collect_all_refs (const char *source_file) { tree t; + unsigned i; - for (t = all_translation_units; t; t = TREE_CHAIN (t)) + FOR_EACH_VEC_ELT (tree, all_translation_units, i, t) collect_ada_nodes (BLOCK_VARS (DECL_INITIAL (t)), source_file); } @@ -9677,8 +9669,9 @@ for_each_global_decl (void (*callback) (tree decl)) tree t; tree decls; tree decl; + unsigned i; - for (t = all_translation_units; t; t = TREE_CHAIN (t)) + FOR_EACH_VEC_ELT (tree, all_translation_units, i, t) { decls = DECL_INITIAL (t); for (decl = BLOCK_VARS (decls); decl; decl = TREE_CHAIN (decl)) @@ -9693,6 +9686,7 @@ void c_write_global_declarations (void) { tree t; + unsigned i; /* We don't want to do this if generating a PCH. */ if (pch_file) @@ -9729,7 +9723,7 @@ c_write_global_declarations (void) /* Process all file scopes in this compilation, and the external_scope, through wrapup_global_declarations and check_global_declarations. */ - for (t = all_translation_units; t; t = DECL_CHAIN (t)) + FOR_EACH_VEC_ELT (tree, all_translation_units, i, t) c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_1 (BLOCK_VARS (ext_block)); @@ -9742,7 +9736,7 @@ c_write_global_declarations (void) if (!seen_error ()) { timevar_push (TV_SYMOUT); - for (t = all_translation_units; t; t = DECL_CHAIN (t)) + FOR_EACH_VEC_ELT (tree, all_translation_units, i, t) c_write_global_declarations_2 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_2 (BLOCK_VARS (ext_block)); timevar_pop (TV_SYMOUT); |