summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7af0eb34853..cfedd13bd28 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -5070,7 +5070,9 @@ is_fortran (void)
{
unsigned int lang = get_AT_unsigned (comp_unit_die, DW_AT_language);
- return lang == DW_LANG_Fortran77 || lang == DW_LANG_Fortran90;
+ return (lang == DW_LANG_Fortran77
+ || lang == DW_LANG_Fortran90
+ || lang == DW_LANG_Fortran95);
}
/* Return TRUE if the language is Java. */
@@ -8829,6 +8831,7 @@ loc_descriptor_from_tree (tree loc, int addressp)
/* Fall through. */
case PARM_DECL:
+ case RESULT_DECL:
{
rtx rtl = rtl_for_decl_location (loc);
@@ -9117,9 +9120,6 @@ loc_descriptor_from_tree (tree loc, int addressp)
}
break;
- case EXPR_WITH_FILE_LOCATION:
- return loc_descriptor_from_tree (EXPR_WFL_NODE (loc), addressp);
-
default:
/* Leave front-end specific codes as simply unknown. This comes
up, for instance, with the C STMT_EXPR. */
@@ -9696,10 +9696,7 @@ rtl_for_decl_location (tree decl)
This happens (for example) for inlined-instances of inline function formal
parameters which are never referenced. This really shouldn't be
happening. All PARM_DECL nodes should get valid non-NULL
- DECL_INCOMING_RTL values, but integrate.c doesn't currently generate these
- values for inlined instances of inline function parameters, so when we see
- such cases, we are just out-of-luck for the time being (until integrate.c
- gets fixed). */
+ DECL_INCOMING_RTL values. FIXME. */
/* Use DECL_RTL as the "location" unless we find something better. */
rtl = DECL_RTL_IF_SET (decl);
@@ -9875,7 +9872,8 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl,
if (TREE_CODE (decl) == ERROR_MARK)
return;
- else if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != PARM_DECL)
+ else if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != PARM_DECL
+ && TREE_CODE (decl) != RESULT_DECL)
abort ();
/* See if we possibly have multiple locations for this variable. */
@@ -10183,6 +10181,7 @@ add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree b
case VAR_DECL:
case PARM_DECL:
+ case RESULT_DECL:
{
dw_die_ref decl_die = lookup_decl_die (bound);
@@ -11343,13 +11342,9 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
add_AT_loc (subr_die, DW_AT_frame_base, reg_loc_descriptor (fp_reg));
}
-#if 0
- /* ??? This fails for nested inline functions, because context_display
- is not part of the state saved/restored for inline functions. */
- if (current_function_needs_context)
+ if (cfun->static_chain_decl)
add_AT_location_description (subr_die, DW_AT_static_link,
- loc_descriptor (lookup_static_chain (decl)));
-#endif
+ loc_descriptor_from_tree (cfun->static_chain_decl, 0));
}
/* Now output descriptions of the arguments for this function. This gets
@@ -11425,6 +11420,10 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
constructor function. */
if (! declaration && TREE_CODE (outer_scope) != ERROR_MARK)
{
+ /* Emit a DW_TAG_variable DIE for a named return value. */
+ if (DECL_NAME (DECL_RESULT (decl)))
+ gen_decl_die (DECL_RESULT (decl), subr_die);
+
current_function_has_inlines = 0;
decls_for_scope (outer_scope, subr_die, 0);
@@ -11769,6 +11768,8 @@ gen_compile_unit_die (const char *filename)
language = DW_LANG_Ada95;
else if (strcmp (language_string, "GNU F77") == 0)
language = DW_LANG_Fortran77;
+ else if (strcmp (language_string, "GNU F95") == 0)
+ language = DW_LANG_Fortran95;
else if (strcmp (language_string, "GNU Pascal") == 0)
language = DW_LANG_Pascal83;
else if (strcmp (language_string, "GNU Java") == 0)
@@ -12578,6 +12579,14 @@ gen_decl_die (tree decl, dw_die_ref context_die)
&& (current_function_decl == NULL_TREE || DECL_ARTIFICIAL (decl)))
break;
+#if 0
+ /* FIXME */
+ /* This doesn't work because the C frontend sets DECL_ABSTRACT_ORIGIN
+ on local redeclarations of global functions. That seems broken. */
+ if (current_function_decl != decl)
+ /* This is only a declaration. */;
+#endif
+
/* If we're emitting a clone, emit info for the abstract instance. */
if (DECL_ORIGIN (decl) != decl)
dwarf2out_abstract_function (DECL_ABSTRACT_ORIGIN (decl));
@@ -12651,6 +12660,7 @@ gen_decl_die (tree decl, dw_die_ref context_die)
break;
case VAR_DECL:
+ case RESULT_DECL:
/* If we are in terse mode, don't generate any DIEs to represent any
variable declarations or definitions. */
if (debug_info_level <= DINFO_LEVEL_TERSE)