diff options
author | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-23 16:07:13 +0000 |
---|---|---|
committer | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-23 16:07:13 +0000 |
commit | 1a4c44c530a88024d10331a5213363152ff3d0fa (patch) | |
tree | 716216bf133fc60984e49edb258a912ca31ba3e8 /gcc/c-decl.c | |
parent | eb241fe973b9160a1e25228289aee69476677da6 (diff) | |
download | gcc-1a4c44c530a88024d10331a5213363152ff3d0fa.tar.gz |
Fix PR debug/41065
gcc/ChangeLog:
PR debug/41065
* function.h (types_used_by_vars_hash): Declare new hash table.
(types_used_by_vars_eq, types_used_by_var_decl_insert): Declare
equality and hash function for the hash table.
(types_used_by_cur_var_decl): Declare a new global chained list.
(types_used_by_var_decl_insert): Declare new function.
* function.c (types_used_by_vars_hash): Define the hashtable ...
(types_used_by_vars_eq, types_used_by_vars_do_hash): ... as well as
its equality and hash functions.
(hash_types_used_by_vars_entry): New hash helper.
(types_used_by_cur_var_decl): Define the global chained list.
(used_types_insert): Update the list of types used by the global
variable being parsed.
(types_used_by_var_decl_insert): Define new function.
* c-common.h (record_types_used_by_current_var_decl): Declare ...
* c-common.c (record_types_used_by_current_var_decl): ... new
function.
* c-decl.c (finish_decl): Record the types used by the global
variable declaration we've just parsed.
* dwarf2out.c (premark_used_types): Insert a new line between
comment and function.
(premark_used_types_helper): Fix comment.
(premark_types_used_by_global_vars_helper,
premark_types_used_by_global_vars): New functions.
(prune_unused_types): Do not prune types used by global variables.
gcc/cp/ChangeLog:
PR debug/41065
* decl.c (cp_finish_decl): Record the types used by the global
variable declaration we've just parsed.
gcc/testsuite/ChangeLog:
PR debug/41065
* gcc.dg/debug/dwarf2/global-used-types.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152085 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index c44e35cff46..e237332f174 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4064,6 +4064,13 @@ finish_decl (tree decl, location_t init_loc, tree init, if (asmspec_tree) asmspec = TREE_STRING_POINTER (asmspec_tree); + if (TREE_CODE (decl) == VAR_DECL + && TREE_STATIC (decl) + && global_bindings_p ()) + /* So decl is a global variable. Record the types it uses + so that we can decide later to emit debug info for them. */ + record_types_used_by_current_var_decl (decl); + /* If `start_decl' didn't like having an initialization, ignore it now. */ if (init != 0 && DECL_INITIAL (decl) == 0) init = 0; |