diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-09 00:47:05 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-09-09 00:47:05 +0000 |
commit | c131e678cadd24a3282cf4835972e185c9e4a053 (patch) | |
tree | 8b288d10d2c8cf110317fdcfab54fc70ab7a2ec6 /gcc/c-decl.c | |
parent | f6e963941102a92ff8212f15a91e799b12e641f5 (diff) | |
download | gcc-c131e678cadd24a3282cf4835972e185c9e4a053.tar.gz |
PR debug/23190
* toplev.c (wrapup_global_declaration_1): Split out ...
(wrapup_global_declaration_2): ... from ...
(wrapup_global_declarations): ... here. Return bool.
(check_global_declaration_1): Split out ...
(check_global_declarations): from here.
(emit_debug_global_declarations): New.
* toplev.h (wrapup_global_declaration_1, wrapup_global_declaration_2,
check_global_declaration_1, emit_debug_global_declarations): Declare.
* c-decl.c (c_write_global_declarations_1): Don't create a vector
of decls. Call wrapup_global_declaration_1,
wrapup_global_declaration_2, check_global_declaration_1 directly.
(c_write_global_declarations_2): New.
(ext_block): New.
(c_write_global_declarations): Call c_write_global_declarations_2.
* langhooks.c (write_global_declarations): Call
emit_debug_global_declarations.
* cgraphunit.c (cgraph_varpool_remove_unreferenced_decls): Don't
remove decls that have DECL_RTL_SET_P.
* passes.c (rest_of_decl_compilation): Invoke
cgraph_varpool_finalize_decl for all but functions.
cp/
* decl.c (wrapup_globals_for_namespace): Call
emit_debug_global_declarations.
* decl2.c (cp_finish_file): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104065 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index f3b8d64a6d3..49c8904fc04 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -7540,20 +7540,18 @@ build_cdtor (int method_type, tree cdtors) cgraph_build_static_cdtor (method_type, body, DEFAULT_INIT_PRIORITY); } -/* Perform final processing on one file scope's declarations (or the - external scope's declarations), GLOBALS. */ +/* A subroutine of c_write_global_declarations. Perform final processing + on one file scope's declarations (or the external scope's declarations), + GLOBALS. */ + static void c_write_global_declarations_1 (tree globals) { - size_t len = list_length (globals); - tree *vec = XNEWVEC (tree, len); - size_t i; tree decl; /* Process the decls in the order they were written. */ - for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl)) + for (decl = globals; decl; decl = TREE_CHAIN (decl)) { - vec[i] = decl; /* Check for used but undefined static functions using the C standard's definition of "used", and set TREE_NO_WARNING so that check_global_declarations doesn't repeat the check. */ @@ -7566,18 +7564,32 @@ c_write_global_declarations_1 (tree globals) pedwarn ("%q+F used but never defined", decl); TREE_NO_WARNING (decl) = 1; } + + wrapup_global_declaration_1 (decl); + wrapup_global_declaration_2 (decl); + check_global_declaration_1 (decl); } +} - wrapup_global_declarations (vec, len); - check_global_declarations (vec, len); +/* A subroutine of c_write_global_declarations Emit debug information for each + of the declarations in GLOBALS. */ - free (vec); +static void +c_write_global_declarations_2 (tree globals) +{ + tree decl; + + for (decl = globals; decl ; decl = TREE_CHAIN (decl)) + debug_hooks->global_decl (decl); } +/* Preserve the external declarations scope across a garbage collect. */ +static GTY(()) tree ext_block; + void c_write_global_declarations (void) { - tree ext_block, t; + tree t; /* We don't want to do this if generating a PCH. */ if (pch_file) @@ -7593,10 +7605,6 @@ c_write_global_declarations (void) external_scope = 0; gcc_assert (!current_scope); - /* 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 = TREE_CHAIN (t)) - c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); if (ext_block) { tree tmp = BLOCK_VARS (ext_block); @@ -7608,6 +7616,11 @@ c_write_global_declarations (void) dump_end (TDI_tu, stream); } } + + /* 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 = TREE_CHAIN (t)) + c_write_global_declarations_1 (BLOCK_VARS (DECL_INITIAL (t))); c_write_global_declarations_1 (BLOCK_VARS (ext_block)); /* Generate functions to call static constructors and destructors @@ -7619,6 +7632,19 @@ c_write_global_declarations (void) /* We're done parsing; proceed to optimize and emit assembly. FIXME: shouldn't be the front end's responsibility to call this. */ cgraph_optimize (); + + /* After cgraph has had a chance to emit everything that's going to + be emitted, output debug information for globals. */ + if (errorcount == 0 && sorrycount == 0) + { + timevar_push (TV_SYMOUT); + for (t = all_translation_units; t; t = TREE_CHAIN (t)) + c_write_global_declarations_2 (BLOCK_VARS (DECL_INITIAL (t))); + c_write_global_declarations_2 (BLOCK_VARS (ext_block)); + timevar_pop (TV_SYMOUT); + } + + ext_block = NULL; } #include "gt-c-decl.h" |