mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-25 20:16:29 +08:00
re PR debug/37959 (g++ does not emit DW_AT_explicit)
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. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r145128
This commit is contained in:
parent
64d7685c6f
commit
68599f330b
@ -1,3 +1,15 @@
|
||||
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
|
||||
|
@ -1,3 +1,11 @@
|
||||
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
|
||||
|
@ -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)
|
||||
|
@ -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. If not see
|
||||
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 (tree, tree, tsubst_flags_t,
|
||||
#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
|
||||
|
@ -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:
|
||||
@ -13611,6 +13613,11 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
|
||||
{
|
||||
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
|
||||
|
@ -189,6 +189,7 @@ extern tree lhd_make_node (enum tree_code);
|
||||
#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
|
||||
@ -208,6 +209,7 @@ extern tree lhd_make_node (enum tree_code);
|
||||
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, \
|
||||
|
@ -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);
|
||||
|
@ -1,3 +1,9 @@
|
||||
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.
|
||||
|
19
gcc/testsuite/g++.dg/debug/dwarf2/explicit-constructor.C
Normal file
19
gcc/testsuite/g++.dg/debug/dwarf2/explicit-constructor.C
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user