aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-04-26 20:44:59 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-04-26 20:44:59 +0200
commita9548ddfe584e4253d3afcf07b5a2cbb5b68a896 (patch)
tree389fce94fdeefafd175cbeb3d0ca842d67200c62 /gcc/dwarf2out.c
parent10555d08b4bee4c92649200866ce0ee9e8d9af5d (diff)
downloadgcc-a9548ddfe584e4253d3afcf07b5a2cbb5b68a896.zip
gcc-a9548ddfe584e4253d3afcf07b5a2cbb5b68a896.tar.gz
gcc-a9548ddfe584e4253d3afcf07b5a2cbb5b68a896.tar.bz2
tree.h (DECL_BY_REFERENCE): Note that it is also valid for !TREE_STATIC VAR_DECLs.
* tree.h (DECL_BY_REFERENCE): Note that it is also valid for !TREE_STATIC VAR_DECLs. * dwarf2out.c (loc_by_reference, gen_decl_die): Handle DECL_BY_REFERENCE on !TREE_STATIC VAR_DECLs. (gen_variable_die): Likewise. Don't look at TREE_PRIVATE if DECL_BY_REFERENCE is valid. * dbxout.c (DECL_ACCESSIBILITY_CHAR): Don't look at TREE_PRIVATE for PARM_DECLs, RESULT_DECLs or !TREE_STATIC VAR_DECLs. * tree-nested.c (get_nonlocal_debug_decl, get_local_debug_decl): Copy DECL_BY_REFERENCE. (struct nesting_copy_body_data): New type. (nesting_copy_decl): New function. (finalize_nesting_tree_1): Remap types of debug_var_chain variables, if they have variable length. From-SVN: r146808
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 69cdb03..0b25382 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11701,7 +11701,9 @@ loc_by_reference (dw_loc_descr_ref loc, tree decl)
if (loc == NULL)
return NULL;
- if ((TREE_CODE (decl) != PARM_DECL && TREE_CODE (decl) != RESULT_DECL)
+ if ((TREE_CODE (decl) != PARM_DECL
+ && TREE_CODE (decl) != RESULT_DECL
+ && (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl)))
|| !DECL_BY_REFERENCE (decl))
return loc;
@@ -14040,12 +14042,19 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
else
{
tree type = TREE_TYPE (decl);
+ bool private_flag_valid = true;
add_name_and_src_coords_attributes (var_die, decl);
if ((TREE_CODE (decl) == PARM_DECL
- || TREE_CODE (decl) == RESULT_DECL)
+ || TREE_CODE (decl) == RESULT_DECL
+ || (TREE_CODE (decl) == VAR_DECL && !TREE_STATIC (decl)))
&& DECL_BY_REFERENCE (decl))
- add_type_attribute (var_die, TREE_TYPE (type), 0, 0, context_die);
+ {
+ add_type_attribute (var_die, TREE_TYPE (type), 0, 0, context_die);
+ /* DECL_BY_REFERENCE uses the same bit as TREE_PRIVATE,
+ for PARM_DECL, RESULT_DECL or non-static VAR_DECL. */
+ private_flag_valid = false;
+ }
else
add_type_attribute (var_die, type, TREE_READONLY (decl),
TREE_THIS_VOLATILE (decl), context_die);
@@ -14058,7 +14067,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
if (TREE_PROTECTED (decl))
add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_protected);
- else if (TREE_PRIVATE (decl))
+ else if (private_flag_valid && TREE_PRIVATE (decl))
add_AT_unsigned (var_die, DW_AT_accessibility, DW_ACCESS_private);
}
@@ -15291,7 +15300,9 @@ gen_decl_die (tree decl, tree origin, dw_die_ref context_die)
/* Output any DIEs that are needed to specify the type of this data
object. */
- if (TREE_CODE (decl_or_origin) == RESULT_DECL
+ if ((TREE_CODE (decl_or_origin) == RESULT_DECL
+ || (TREE_CODE (decl_or_origin) == VAR_DECL
+ && !TREE_STATIC (decl_or_origin)))
&& DECL_BY_REFERENCE (decl_or_origin))
gen_type_die (TREE_TYPE (TREE_TYPE (decl_or_origin)), context_die);
else