diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-10-24 18:44:30 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-10-24 18:44:30 +0000 |
commit | 1eaf0150a7c6ad8a88189579f15bb23d211a97e4 (patch) | |
tree | 6675f8e8df8869495a58275f084067520862325c | |
parent | 7829b1ae57e3094ec91ea850c9cbcdb536b6f045 (diff) | |
download | gcc-1eaf0150a7c6ad8a88189579f15bb23d211a97e4.tar.gz |
* dwarf2out.c (gen_subprogram_die): Add DW_AT_reference or
DW_AT_rvalue_reference attributes.
* cp-objcp-common.c (cp_decl_dwarf_attribute): Handle DW_AT_reference
and DW_AT_rvalue_reference.
* g++.dg/debug/dwarf2/ref-2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241492 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 26 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 15 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C | 20 |
6 files changed, 73 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1f6712e6144..88bace4ea16 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-24 Jakub Jelinek <jakub@redhat.com> + + * dwarf2out.c (gen_subprogram_die): Add DW_AT_reference or + DW_AT_rvalue_reference attributes. + 2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de> * doc/invoke.text (Wint-in-bool-context): Update documentation. diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0c5da96c3d3..744eb5288a2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-10-24 Jakub Jelinek <jakub@redhat.com> + * cp-objcp-common.c (cp_decl_dwarf_attribute): Handle DW_AT_reference + and DW_AT_rvalue_reference. + * cxx-pretty-print.c (pp_cxx_check_constraint): Use VAR_P (x) instead of TREE_CODE (x) == VAR_DECL. * constraint.cc (get_concept_definition): Likewise. diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index 50ac07f0790..070b64c5d82 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -173,6 +173,32 @@ cp_decl_dwarf_attribute (const_tree decl, int attr) return 1; break; + case DW_AT_reference: + if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl)) + && !FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl))) + return 1; + if ((TREE_CODE (decl) == FUNCTION_TYPE + || TREE_CODE (decl) == METHOD_TYPE) + && FUNCTION_REF_QUALIFIED (decl) + && !FUNCTION_RVALUE_QUALIFIED (decl)) + return 1; + break; + + case DW_AT_rvalue_reference: + if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl) + && FUNCTION_REF_QUALIFIED (TREE_TYPE (decl)) + && FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (decl))) + return 1; + if ((TREE_CODE (decl) == FUNCTION_TYPE + || TREE_CODE (decl) == METHOD_TYPE) + && FUNCTION_REF_QUALIFIED (decl) + && FUNCTION_RVALUE_QUALIFIED (decl)) + return 1; + break; + default: break; } diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b059ed2a3ee..515ee6e4261 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -20662,6 +20662,21 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) if (defaulted != -1) add_AT_unsigned (subr_die, DW_AT_defaulted, defaulted); } + + /* If this is a C++11 non-static member function with & ref-qualifier + then generate a DW_AT_reference attribute. */ + if ((dwarf_version >= 5 || !dwarf_strict) + && lang_hooks.decls.decl_dwarf_attribute (decl, + DW_AT_reference) == 1) + add_AT_flag (subr_die, DW_AT_reference, 1); + + /* If this is a C++11 non-static member function with && + ref-qualifier then generate a DW_AT_reference attribute. */ + if ((dwarf_version >= 5 || !dwarf_strict) + && lang_hooks.decls.decl_dwarf_attribute (decl, + DW_AT_rvalue_reference) + == 1) + add_AT_flag (subr_die, DW_AT_rvalue_reference, 1); } } /* Tag abstract instances with DW_AT_inline. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5b83f4de125..dc5f13ee391 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-10-24 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/debug/dwarf2/ref-2.C: New test. + 2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de> * c-c++-common/Wint-in-bool-context-3.c: New test. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C new file mode 100644 index 00000000000..dd1f457d3ec --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/ref-2.C @@ -0,0 +1,20 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-g -gno-strict-dwarf -dA" } +// { dg-final { scan-assembler-times " DW_AT_reference" 1 } } +// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 1 } } + +struct S +{ + void foo (); + void bar () &; + void baz () &&; +}; + +void +test () +{ + S s; + s.foo (); + s.bar (); + S ().baz (); +} |