From: jakub Date: Fri, 27 Mar 2009 21:44:21 +0000 (+0000) Subject: PR debug/37959 X-Git-Tag: upstream/4.9.2~37387 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb3582e73cdcb0d283d873e62bb1d1223085f687;p=platform%2Fupstream%2Flinaro-gcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145128 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 89c62b5..d7a6635 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2009-03-27 Dodji Seketeli + Jakub Jelinek + + 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 * builtins.c (fold_builtin_memory_op): Optimize memmove diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6fcd92a..477e84b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2009-03-27 Dodji Seketeli + Jakub Jelinek + + 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 PR c++/38638 diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index fefafb1..daefa2b 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -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 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) diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index f241075..bda23eb 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -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 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 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9bf0803c..1c82f9c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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 diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index f9f8cde..96c091c 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -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, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 52d1f24..4069578 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9aecc57..6898d86 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-03-27 Dodji Seketeli + Jakub Jelinek + + PR debug/37959 + * g++.dg/debug/dwarf2/explicit-constructor.C: New test. + 2009-03-27 Jakub Jelinek * gcc.dg/memmove-2.c: New test. diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/explicit-constructor.C b/gcc/testsuite/g++.dg/debug/dwarf2/explicit-constructor.C new file mode 100644 index 0000000..42fd264 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/explicit-constructor.C @@ -0,0 +1,19 @@ +// Contributed by Dodji Seketeli +// 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; +}