* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145128
138bc75d-0d04-0410-961f-
82ee72b054a4
+2009-03-27 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.
+
2009-03-27 Jakub Jelinek <jakub@redhat.com>
* builtins.c (fold_builtin_memory_op): Optimize memmove
+2009-03-27 Dodji Seketeli <dodji@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/37959
+ * 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.
+
2009-03-27 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR c++/38638
/* 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.
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)
/* 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.
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. */
#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
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:
{
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
#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
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, \
/* 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);
+2009-03-27 Dodji Seketeli <dodji@redhat.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/37959
+ * g++.dg/debug/dwarf2/explicit-constructor.C: New test.
+
2009-03-27 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/memmove-2.c: New test.
--- /dev/null
+// 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;
+}