re PR debug/28767 (GCC should output DW_TAG_ptr_to_member for member functions)
authorJakub Jelinek <jakub@gcc.gnu.org>
Thu, 3 Nov 2016 21:18:49 +0000 (22:18 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 3 Nov 2016 21:18:49 +0000 (22:18 +0100)
commit6905c577d1c41317205f16ea137844f825a9af71
treecc3fb0f31847cda7c470c5f67f99330aa7943907
parent1906d6b4dc4cf6bddb82e9dc3534438230030a8e
re PR debug/28767 (GCC should output DW_TAG_ptr_to_member for member functions)

PR debug/28767
PR debug/56974
* langhooks.h (struct lang_hooks_for_types): Add type_dwarf_attribute
langhook.
* langhooks.c (lhd_type_dwarf_attribute): New function.
* langhooks-def.h (lhd_type_dwarf_attribute): Declare.
(LANG_HOOKS_TYPE_DWARF_ATTRIBUTE): Define.
(LANG_HOOKS_FOR_TYPES_INITIALIZER): Add
LANG_HOOKS_TYPE_DWARF_ATTRIBUTE.
(check_qualified_type, check_aligned_type): Call it.
* dwarf2out.c (modified_type_die): Don't use type_main_variant
for FUNCTION_TYPE or METHOD_TYPE, instead walk over variants with
check_base_type and check_lang_type.
(gen_ptr_to_mbr_type_die): If lookup_type_die is already non-NULL,
return early.  For pointer-to-data-member add DW_AT_use_location
attribute.
(gen_subroutine_type_die): Add DW_AT_{,rvalue_}reference attribute
if needed.
(gen_type_die_with_usage): Don't use type_main_variant
for FUNCTION_TYPE or METHOD_TYPE, instead walk over variants with
check_base_type and check_lang_type.  Formatting fixes. Call
get_debug_type langhook.
cp/
* tree.c (cp_check_qualified_type): Use check_base_type and
TYPE_QUALS comparison instead of check_qualified_type.
(cxx_type_hash_eq): Return false if type_memfn_rqual don't match.
* cp-objcp-common.c (cp_get_debug_type): New function.
(cp_decl_dwarf_attribute): Don't handle types here.
(cp_type_dwarf_attribute): New function.
* cp-objcp-common.h (cp_get_debug_type, cp_type_dwarf_attribute):
Declare.
(LANG_HOOKS_GET_DEBUG_TYPE, LANG_HOOKS_TYPE_DWARF_ATTRIBUTE):
Define.
testsuite/
* g++.dg/debug/dwarf2/ptrdmem-1.C: New test.
* g++.dg/debug/dwarf2/ref-3.C: New test.
* g++.dg/debug/dwarf2/ref-4.C: New test.
* g++.dg/debug/dwarf2/refqual-1.C: New test.
* g++.dg/debug/dwarf2/refqual-2.C: New test.

From-SVN: r241832
14 files changed:
gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/cp-objcp-common.c
gcc/cp/cp-objcp-common.h
gcc/dwarf2out.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/ref-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/ref-4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C [new file with mode: 0644]