Commit 0f2a9e37 by Jakub Jelinek Committed by Jakub Jelinek

dwarf2out.c (gen_subprogram_die): Add DW_AT_reference or DW_AT_rvalue_reference attributes.

	* 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.

From-SVN: r241492
parent 33107571
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> 2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de>
* doc/invoke.text (Wint-in-bool-context): Update documentation. * doc/invoke.text (Wint-in-bool-context): Update documentation.
......
2016-10-24 Jakub Jelinek <jakub@redhat.com> 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) * cxx-pretty-print.c (pp_cxx_check_constraint): Use VAR_P (x)
instead of TREE_CODE (x) == VAR_DECL. instead of TREE_CODE (x) == VAR_DECL.
* constraint.cc (get_concept_definition): Likewise. * constraint.cc (get_concept_definition): Likewise.
......
...@@ -173,6 +173,32 @@ cp_decl_dwarf_attribute (const_tree decl, int attr) ...@@ -173,6 +173,32 @@ cp_decl_dwarf_attribute (const_tree decl, int attr)
return 1; return 1;
break; 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: default:
break; break;
} }
......
...@@ -20662,6 +20662,21 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) ...@@ -20662,6 +20662,21 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
if (defaulted != -1) if (defaulted != -1)
add_AT_unsigned (subr_die, DW_AT_defaulted, defaulted); 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. */ /* Tag abstract instances with DW_AT_inline. */
......
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> 2016-10-24 Bernd Edlinger <bernd.edlinger@hotmail.de>
* c-c++-common/Wint-in-bool-context-3.c: New test. * c-c++-common/Wint-in-bool-context-3.c: New test.
......
// { 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 ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment