]> gcc.gnu.org Git - gcc.git/commit
c++, debug: Fix up locus of DW_TAG_imported_module [PR108716]
authorJakub Jelinek <jakub@redhat.com>
Thu, 2 Mar 2023 18:17:52 +0000 (19:17 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 3 May 2023 12:58:40 +0000 (14:58 +0200)
commit17ea4d1f5d3609ef2540a10c29f57c0bd185ba4b
tree2592b8d6197f0c8e94e669c96703f7eaa74e45fa
parentf1789989ca265abaa246592cd4223cc3ca89b361
c++, debug: Fix up locus of DW_TAG_imported_module [PR108716]

Before IMPORTED_DECL has been introduced in PR37410, we used to emit correct
DW_AT_decl_line on DW_TAG_imported_module on the testcase below, after that
change we haven't emitted it at all for a while and after some time
started emitting incorrect locus, in particular the location of } closing
the function.

The problem is that while we have correct EXPR_LOCATION on the USING_STMT,
when genericizing that USING_STMT into IMPORTED_DECL we don't copy the
location to DECL_SOURCE_LOCATION, so it gets whatever input_location happens
to be when it is created.

2023-03-02  Jakub Jelinek  <jakub@redhat.com>

PR debug/108716
* cp-gimplify.c (cp_genericize_r) <case USING_STMT>: Set
DECL_SOURCE_LOCATION on IMPORTED_DECL to expression location
of USING_STMT or input_location.

* g++.dg/debug/dwarf2/pr108716.C: New test.

(cherry picked from commit 4d82022bfd15d36717bf60a11e75e9ea02204269)
gcc/cp/cp-gimplify.c
gcc/testsuite/g++.dg/debug/dwarf2/pr108716.C [new file with mode: 0644]
This page took 0.058197 seconds and 6 git commands to generate.