aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-11-10 18:02:04 -0500
committerJason Merrill <jason@redhat.com>2020-11-12 00:58:04 -0500
commit87b7d45e358e4df93b6a93b2e7a55b123ea76f5d (patch)
tree79fa060941ef1ec3bc359c0e3d4963c37af7dcf6 /gcc/dwarf2out.c
parentd33bc98f5bc65f2505fcaefb0f9055ec67fe36d2 (diff)
downloadgcc-87b7d45e358e4df93b6a93b2e7a55b123ea76f5d.zip
gcc-87b7d45e358e4df93b6a93b2e7a55b123ea76f5d.tar.gz
gcc-87b7d45e358e4df93b6a93b2e7a55b123ea76f5d.tar.bz2
dwarf2: Set DW_AT_declaration for undefined fns [PR97060]
If DECL_INITIAL isn't set, we can't emit anything about the body of the function, so add the declaration attribute. gcc/ChangeLog: PR debug/97060 * dwarf2out.c (gen_subprogram_die): It's a declaration if DECL_INITIAL isn't set. gcc/testsuite/ChangeLog: PR debug/97060 * gcc.dg/debug/dwarf2/pr97060.c: New test.
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index bea02f9..4452b9f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -22859,6 +22859,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
available.
*/
int declaration = (current_function_decl != decl
+ || (!DECL_INITIAL (decl) && !origin)
|| class_or_namespace_scope_p (context_die));
/* A declaration that has been previously dumped needs no