diff options
author | Dodji Seketeli <dodji@redhat.com> | 2009-09-23 16:07:13 +0000 |
---|---|---|
committer | Dodji Seketeli <dodji@gcc.gnu.org> | 2009-09-23 18:07:13 +0200 |
commit | b646ba3f1c134c4fc22b000caff77725ccec1791 (patch) | |
tree | 716216bf133fc60984e49edb258a912ca31ba3e8 /gcc/c-common.c | |
parent | 4c6858252cf0b39482c1a436f6d9dcd7cc0a44f9 (diff) | |
download | gcc-b646ba3f1c134c4fc22b000caff77725ccec1791.zip gcc-b646ba3f1c134c4fc22b000caff77725ccec1791.tar.gz gcc-b646ba3f1c134c4fc22b000caff77725ccec1791.tar.bz2 |
re PR debug/41065 (DW_TAG_enumeration_type+DW_TAG_enumerator is sometimes missing)
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.
From-SVN: r152085
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 25c0c01..a9e1286 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -9182,6 +9182,31 @@ is_typedef_decl (tree x) && DECL_ORIGINAL_TYPE (x) != NULL_TREE); } +/* Record the types used by the current global variable declaration + being parsed, so that we can decide later to emit their debug info. + Those types are in types_used_by_cur_var_decl, and we are going to + store them in the types_used_by_vars_hash hash table. + DECL is the declaration of the global variable that has been parsed. */ + +void +record_types_used_by_current_var_decl (tree decl) +{ + gcc_assert (decl && DECL_P (decl) && TREE_STATIC (decl)); + + if (types_used_by_cur_var_decl) + { + tree node; + for (node = types_used_by_cur_var_decl; + node; + node = TREE_CHAIN (node)) + { + tree type = TREE_PURPOSE (node); + types_used_by_var_decl_insert (type, decl); + } + types_used_by_cur_var_decl = NULL; + } +} + /* The C and C++ parsers both use vectors to hold function arguments. For efficiency, we keep a cache of unused vectors. This is the cache. */ |