From b646ba3f1c134c4fc22b000caff77725ccec1791 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 23 Sep 2009 16:07:13 +0000 Subject: 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 --- gcc/function.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'gcc/function.h') diff --git a/gcc/function.h b/gcc/function.h index 72aad00..4825d16 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -622,6 +622,28 @@ extern int virtuals_instantiated; /* Nonzero if at least one trampoline has been created. */ extern int trampolines_created; +struct GTY(()) types_used_by_vars_entry { + tree type; + tree var_decl; +}; + +/* Hash table making the relationship between a global variable + and the types it references in its initializer. The key of the + entry is a referenced type, and the value is the DECL of the global + variable. types_use_by_vars_do_hash and types_used_by_vars_eq below are + the hash and equality functions to use for this hash table. */ +extern GTY((param_is (struct types_used_by_vars_entry))) htab_t + types_used_by_vars_hash; + +hashval_t types_used_by_vars_do_hash (const void*); +int types_used_by_vars_eq (const void *, const void *); +void types_used_by_var_decl_insert (tree type, tree var_decl); + +/* During parsing of a global variable, this linked list points to + the list of types referenced by the global variable. */ +extern GTY(()) tree types_used_by_cur_var_decl; + + /* cfun shouldn't be set directly; use one of these functions instead. */ extern void set_cfun (struct function *new_cfun); extern void push_cfun (struct function *new_cfun); -- cgit v1.1