147 lines
5.6 KiB
Diff
147 lines
5.6 KiB
Diff
2009-03-18 Dodji Seketeli <dodji@redhat.com>
|
|
Jakub Jelinek <jakub@redhat.com>
|
|
|
|
PR debug/37959
|
|
* dwarf2out.c (dwarf_attr_name): Handle DW_AT_explicit attribute.
|
|
(gen_subprogram_die): When a function is explicit, generate the DW_AT_explicit
|
|
attribute.
|
|
* langhooks.h (struct lang_hooks_for_decls): Add function_decl_explicit_p
|
|
langhook.
|
|
* langhooks-def.h (LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P): Define.
|
|
(LANG_HOOKS_DECLS): Add LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P.
|
|
|
|
* cp-objcp-common.h (LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P): Define.
|
|
(cp_function_decl_explicit_p): New prototype.
|
|
* cp-objcp-common.c (cp_function_decl_explicit_p): New function.
|
|
|
|
* g++.dg/debug/dwarf2/explicit-constructor.C: New test.
|
|
|
|
--- gcc/cp/cp-objcp-common.c.jj 2009-03-05 22:32:17.000000000 +0100
|
|
+++ gcc/cp/cp-objcp-common.c 2009-03-18 14:31:17.000000000 +0100
|
|
@@ -1,5 +1,5 @@
|
|
/* Some code common to C++ and ObjC++ front ends.
|
|
- Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
|
|
+ Copyright (C) 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
|
|
Contributed by Ziemowit Laski <zlaski@apple.com>
|
|
|
|
This file is part of GCC.
|
|
@@ -203,6 +203,16 @@ cxx_staticp (tree arg)
|
|
return NULL_TREE;
|
|
}
|
|
|
|
+/* Return true if DECL is explicit member function. */
|
|
+
|
|
+bool
|
|
+cp_function_decl_explicit_p (tree decl)
|
|
+{
|
|
+ return (decl
|
|
+ && FUNCTION_FIRST_USER_PARMTYPE (decl) != void_list_node
|
|
+ && DECL_NONCONVERTING_P (decl));
|
|
+}
|
|
+
|
|
/* Stubs to keep c-opts.c happy. */
|
|
void
|
|
push_file_scope (void)
|
|
--- gcc/cp/cp-objcp-common.h.jj 2009-03-02 16:21:33.000000000 +0100
|
|
+++ gcc/cp/cp-objcp-common.h 2009-03-18 14:33:51.000000000 +0100
|
|
@@ -1,5 +1,5 @@
|
|
/* Language hooks common to C++ and ObjC++ front ends.
|
|
- Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
|
|
+ Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
|
|
Contributed by Ziemowit Laski <zlaski@apple.com>
|
|
|
|
This file is part of GCC.
|
|
@@ -26,6 +26,8 @@ along with GCC; see the file COPYING3.
|
|
extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
|
|
tree, bool);
|
|
|
|
+extern bool cp_function_decl_explicit_p (tree decl);
|
|
+
|
|
/* Lang hooks that are shared between C++ and ObjC++ are defined here. Hooks
|
|
specific to C++ or ObjC++ go in cp/cp-lang.c and objcp/objcp-lang.c,
|
|
respectively. */
|
|
@@ -131,6 +133,8 @@ extern tree objcp_tsubst_copy_and_build
|
|
#define LANG_HOOKS_TO_TARGET_CHARSET c_common_to_target_charset
|
|
#undef LANG_HOOKS_GIMPLIFY_EXPR
|
|
#define LANG_HOOKS_GIMPLIFY_EXPR cp_gimplify_expr
|
|
+#undef LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P
|
|
+#define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
|
|
#undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
|
|
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING cxx_omp_predetermined_sharing
|
|
#undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
|
|
--- gcc/langhooks-def.h.jj 2009-03-18 14:24:43.000000000 +0100
|
|
+++ gcc/langhooks-def.h 2009-03-18 14:32:37.000000000 +0100
|
|
@@ -190,6 +190,7 @@ extern tree lhd_make_node (enum tree_cod
|
|
#define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
|
|
#define LANG_HOOKS_PUSHDECL pushdecl
|
|
#define LANG_HOOKS_GETDECLS getdecls
|
|
+#define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P hook_bool_tree_false
|
|
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
|
|
#define LANG_HOOKS_WRITE_GLOBALS write_global_declarations
|
|
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
|
|
@@ -209,6 +210,7 @@ extern tree lhd_make_node (enum tree_cod
|
|
LANG_HOOKS_GLOBAL_BINDINGS_P, \
|
|
LANG_HOOKS_PUSHDECL, \
|
|
LANG_HOOKS_GETDECLS, \
|
|
+ LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P, \
|
|
LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, \
|
|
LANG_HOOKS_WRITE_GLOBALS, \
|
|
LANG_HOOKS_DECL_OK_FOR_SIBCALL, \
|
|
--- gcc/langhooks.h.jj 2009-03-18 14:24:43.000000000 +0100
|
|
+++ gcc/langhooks.h 2009-03-18 14:32:06.000000000 +0100
|
|
@@ -159,6 +159,9 @@ struct lang_hooks_for_decls
|
|
/* Returns the chain of decls so far in the current scope level. */
|
|
tree (*getdecls) (void);
|
|
|
|
+ /* Returns true if DECL is explicit member function. */
|
|
+ bool (*function_decl_explicit_p) (tree);
|
|
+
|
|
/* Returns true when we should warn for an unused global DECL.
|
|
We will already have checked that it has static binding. */
|
|
bool (*warn_unused_global) (const_tree);
|
|
--- gcc/dwarf2out.c.jj 2009-03-18 14:24:43.000000000 +0100
|
|
+++ gcc/dwarf2out.c 2009-03-18 14:33:04.000000000 +0100
|
|
@@ -5599,6 +5599,8 @@ dwarf_attr_name (unsigned int attr)
|
|
return "DW_AT_encoding";
|
|
case DW_AT_external:
|
|
return "DW_AT_external";
|
|
+ case DW_AT_explicit:
|
|
+ return "DW_AT_explicit";
|
|
case DW_AT_frame_base:
|
|
return "DW_AT_frame_base";
|
|
case DW_AT_friend:
|
|
@@ -13620,6 +13622,11 @@ gen_subprogram_die (tree decl, dw_die_re
|
|
{
|
|
add_AT_flag (subr_die, DW_AT_declaration, 1);
|
|
|
|
+ /* If this is an explicit function declaration then generate
|
|
+ a DW_AT_explicit attribute. */
|
|
+ if (lang_hooks.decls.function_decl_explicit_p (decl))
|
|
+ add_AT_flag (subr_die, DW_AT_explicit, 1);
|
|
+
|
|
/* The first time we see a member function, it is in the context of
|
|
the class to which it belongs. We make sure of this by emitting
|
|
the class first. The next time is the definition, which is
|
|
--- gcc/testsuite/g++.dg/debug/dwarf2/explicit-constructor.C.jj 2009-03-18 14:24:55.000000000 +0100
|
|
+++ gcc/testsuite/g++.dg/debug/dwarf2/explicit-constructor.C 2009-03-18 14:24:55.000000000 +0100
|
|
@@ -0,0 +1,19 @@
|
|
+// Contributed by Dodji Seketeli <dodji@redhat.com>
|
|
+// Origin: PR c++
|
|
+// { dg-do compile }
|
|
+// { dg-options "-O -g -dA" }
|
|
+// { dg-final { scan-assembler-times "DW_AT_explicit" 2 } }
|
|
+
|
|
+struct Foo
|
|
+{
|
|
+ Foo () {}
|
|
+ explicit Foo (int) {}
|
|
+ Foo (char) {}
|
|
+ ~Foo () {};
|
|
+};
|
|
+
|
|
+void
|
|
+bar ()
|
|
+{
|
|
+ Foo foo;
|
|
+}
|