diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-10-17 08:53:00 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-10-17 08:53:00 +0200 |
commit | 81b42cc69beca2d92cf2675b8b3c1c714f8f74fd (patch) | |
tree | 811f8875b4efdbf7940bca258ddcf5f69be38c13 /gcc/cp | |
parent | 7d66648f6c1ba3f353dadd26a0caf3d5ceebb51c (diff) | |
download | gcc-81b42cc69beca2d92cf2675b8b3c1c714f8f74fd.zip gcc-81b42cc69beca2d92cf2675b8b3c1c714f8f74fd.tar.gz gcc-81b42cc69beca2d92cf2675b8b3c1c714f8f74fd.tar.bz2 |
langhooks.h (struct lang_hooks_for_decls): Remove function_decl_explicit_p...
* langhooks.h (struct lang_hooks_for_decls): Remove
function_decl_explicit_p, function_decl_deleted_p and
function_decl_defaulted hooks. Add decl_dwarf_attribute hook.
* langhooks-def.h (lhd_decl_dwarf_attribute): Declare.
(LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P,
LANG_HOOKS_FUNCTION_DECL_DELETED_P,
LANG_HOOKS_FUNCTION_DECL_DEFAULTED): Remove.
(LANG_HOOKS_DECL_DWARF_ATTRIBUTE): Define.
(LANG_HOOKS_DECLS): Remove LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P,
LANG_HOOKS_FUNCTION_DECL_DELETED_P and
LANG_HOOKS_FUNCTION_DECL_DEFAULTED. Add
LANG_HOOKS_DECL_DWARF_ATTRIBUTE.
* langhooks.c (lhd_decl_dwarf_attribute): New function.
* dwarf2out.c (gen_subprogram_die): Use
lang_hooks.decls.decl_dwarf_attribute instead of
lang_hooks.decls.function_decl_*.
cp/
* cp-objcp-common.h (cp_function_decl_explicit_p,
cp_function_decl_deleted_p, cp_function_decl_defaulted): Remove.
(cp_decl_dwarf_attribute): Declare.
(LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P,
LANG_HOOKS_FUNCTION_DECL_DELETED_P,
LANG_HOOKS_FUNCTION_DECL_DEFAULTED): Remove.
(LANG_HOOKS_DECL_DWARF_ATTRIBUTE): Redefine.
* cp-objcp-common.c (cp_function_decl_explicit_p,
cp_function_decl_deleted_p, cp_function_decl_defaulted): Remove.
(cp_decl_dwarf_attribute): New function.
From-SVN: r241227
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.c | 64 | ||||
-rw-r--r-- | gcc/cp/cp-objcp-common.h | 12 |
3 files changed, 50 insertions, 39 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 54ffee8..d2e6fa8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2016-10-17 Jakub Jelinek <jakub@redhat.com> + + * cp-objcp-common.h (cp_function_decl_explicit_p, + cp_function_decl_deleted_p, cp_function_decl_defaulted): Remove. + (cp_decl_dwarf_attribute): Declare. + (LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P, + LANG_HOOKS_FUNCTION_DECL_DELETED_P, + LANG_HOOKS_FUNCTION_DECL_DEFAULTED): Remove. + (LANG_HOOKS_DECL_DWARF_ATTRIBUTE): Redefine. + * cp-objcp-common.c (cp_function_decl_explicit_p, + cp_function_decl_deleted_p, cp_function_decl_defaulted): Remove. + (cp_decl_dwarf_attribute): New function. + 2016-10-15 Jason Merrill <jason@redhat.com> PR c++/77945 diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c index ac1bb63..abcc1ca 100644 --- a/gcc/cp/cp-objcp-common.c +++ b/gcc/cp/cp-objcp-common.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "cp-tree.h" #include "cp-objcp-common.h" +#include "dwarf2.h" /* Special routine to get the alias set for C++. */ @@ -130,45 +131,48 @@ cxx_types_compatible_p (tree x, tree y) return same_type_ignoring_top_level_qualifiers_p (x, y); } -/* Return true if DECL is explicit member function. */ - -bool -cp_function_decl_explicit_p (const_tree decl) +/* Return -1 if dwarf ATTR shouldn't be added for DECL, or the attribute + value otherwise. */ +int +cp_decl_dwarf_attribute (const_tree decl, int attr) { - return (decl - && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl)) - && DECL_NONCONVERTING_P (decl)); -} + if (decl == NULL_TREE) + return -1; -/* Return true if DECL is deleted special member function. */ + switch (attr) + { + case DW_AT_explicit: + if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl)) + && DECL_NONCONVERTING_P (decl)) + return 1; + break; -bool -cp_function_decl_deleted_p (const_tree decl) -{ - return (decl + case DW_AT_deleted: + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl)) - && DECL_DELETED_FN (decl)); -} + && DECL_DELETED_FN (decl)) + return 1; + break; -/* Returns 0 if DECL is NOT a C++11 defaulted special member function, - 1 if it is explicitly defaulted within the class body, or 2 if it - is explicitly defaulted outside the class body. */ + case DW_AT_defaulted: + if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl)) + && DECL_DEFAULTED_FN (decl)) + { + if (DECL_DEFAULTED_IN_CLASS_P (decl)) + return DW_DEFAULTED_in_class; -int -cp_function_decl_defaulted (const_tree decl) -{ - if (decl - && DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl)) - && DECL_DEFAULTED_FN (decl)) - { - if (DECL_DEFAULTED_IN_CLASS_P (decl)) - return 1; + if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl)) + return DW_DEFAULTED_out_of_class; + } + break; - if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl)) - return 2; + default: + break; } - return 0; + return -1; } /* Stubs to keep c-opts.c happy. */ diff --git a/gcc/cp/cp-objcp-common.h b/gcc/cp/cp-objcp-common.h index 3ad3eb6..9dd847e 100644 --- a/gcc/cp/cp-objcp-common.h +++ b/gcc/cp/cp-objcp-common.h @@ -26,9 +26,7 @@ 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 (const_tree decl); -extern bool cp_function_decl_deleted_p (const_tree decl); -extern int cp_function_decl_defaulted (const_tree decl); +extern int cp_decl_dwarf_attribute (const_tree, int); extern void cp_common_init_ts (void); /* Lang hooks that are shared between C++ and ObjC++ are defined here. Hooks @@ -131,12 +129,8 @@ extern void cp_common_init_ts (void); #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_FUNCTION_DECL_DELETED_P -#define LANG_HOOKS_FUNCTION_DECL_DELETED_P cp_function_decl_deleted_p -#undef LANG_HOOKS_FUNCTION_DECL_DEFAULTED -#define LANG_HOOKS_FUNCTION_DECL_DEFAULTED cp_function_decl_defaulted +#undef LANG_HOOKS_DECL_DWARF_ATTRIBUTE +#define LANG_HOOKS_DECL_DWARF_ATTRIBUTE cp_decl_dwarf_attribute #undef LANG_HOOKS_OMP_PREDETERMINED_SHARING #define LANG_HOOKS_OMP_PREDETERMINED_SHARING cxx_omp_predetermined_sharing #undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR |