mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
7d66648f6c
commit
81b42cc69b
|
|
@ -1,3 +1,22 @@
|
||||||
|
2016-10-17 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
* 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_*.
|
||||||
|
|
||||||
2016-10-16 Eric Botcazou <ebotcazou@adacore.com>
|
2016-10-16 Eric Botcazou <ebotcazou@adacore.com>
|
||||||
|
|
||||||
PR ada/37139
|
PR ada/37139
|
||||||
|
|
|
||||||
|
|
@ -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>
|
2016-10-15 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
PR c++/77945
|
PR c++/77945
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#include "coretypes.h"
|
#include "coretypes.h"
|
||||||
#include "cp-tree.h"
|
#include "cp-tree.h"
|
||||||
#include "cp-objcp-common.h"
|
#include "cp-objcp-common.h"
|
||||||
|
#include "dwarf2.h"
|
||||||
|
|
||||||
/* Special routine to get the alias set for C++. */
|
/* 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 same_type_ignoring_top_level_qualifiers_p (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return true if DECL is explicit member function. */
|
/* Return -1 if dwarf ATTR shouldn't be added for DECL, or the attribute
|
||||||
|
value otherwise. */
|
||||||
bool
|
|
||||||
cp_function_decl_explicit_p (const_tree decl)
|
|
||||||
{
|
|
||||||
return (decl
|
|
||||||
&& DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
|
|
||||||
&& DECL_NONCONVERTING_P (decl));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return true if DECL is deleted special member function. */
|
|
||||||
|
|
||||||
bool
|
|
||||||
cp_function_decl_deleted_p (const_tree decl)
|
|
||||||
{
|
|
||||||
return (decl
|
|
||||||
&& DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
|
|
||||||
&& DECL_DELETED_FN (decl));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
cp_function_decl_defaulted (const_tree decl)
|
cp_decl_dwarf_attribute (const_tree decl, int attr)
|
||||||
{
|
{
|
||||||
if (decl
|
if (decl == NULL_TREE)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
case DW_AT_deleted:
|
||||||
|
if (TREE_CODE (decl) == FUNCTION_DECL
|
||||||
|
&& DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
|
||||||
|
&& DECL_DELETED_FN (decl))
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DW_AT_defaulted:
|
||||||
|
if (TREE_CODE (decl) == FUNCTION_DECL
|
||||||
&& DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
|
&& DECL_LANG_SPECIFIC (STRIP_TEMPLATE (decl))
|
||||||
&& DECL_DEFAULTED_FN (decl))
|
&& DECL_DEFAULTED_FN (decl))
|
||||||
{
|
{
|
||||||
if (DECL_DEFAULTED_IN_CLASS_P (decl))
|
if (DECL_DEFAULTED_IN_CLASS_P (decl))
|
||||||
return 1;
|
return DW_DEFAULTED_in_class;
|
||||||
|
|
||||||
if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl))
|
if (DECL_DEFAULTED_OUTSIDE_CLASS_P (decl))
|
||||||
return 2;
|
return DW_DEFAULTED_out_of_class;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stubs to keep c-opts.c happy. */
|
/* Stubs to keep c-opts.c happy. */
|
||||||
|
|
|
||||||
|
|
@ -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,
|
extern tree objcp_tsubst_copy_and_build (tree, tree, tsubst_flags_t,
|
||||||
tree, bool);
|
tree, bool);
|
||||||
|
|
||||||
extern bool cp_function_decl_explicit_p (const_tree decl);
|
extern int cp_decl_dwarf_attribute (const_tree, int);
|
||||||
extern bool cp_function_decl_deleted_p (const_tree decl);
|
|
||||||
extern int cp_function_decl_defaulted (const_tree decl);
|
|
||||||
extern void cp_common_init_ts (void);
|
extern void cp_common_init_ts (void);
|
||||||
|
|
||||||
/* Lang hooks that are shared between C++ and ObjC++ are defined here. Hooks
|
/* 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
|
#define LANG_HOOKS_TO_TARGET_CHARSET c_common_to_target_charset
|
||||||
#undef LANG_HOOKS_GIMPLIFY_EXPR
|
#undef LANG_HOOKS_GIMPLIFY_EXPR
|
||||||
#define LANG_HOOKS_GIMPLIFY_EXPR cp_gimplify_expr
|
#define LANG_HOOKS_GIMPLIFY_EXPR cp_gimplify_expr
|
||||||
#undef LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P
|
#undef LANG_HOOKS_DECL_DWARF_ATTRIBUTE
|
||||||
#define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P cp_function_decl_explicit_p
|
#define LANG_HOOKS_DECL_DWARF_ATTRIBUTE cp_decl_dwarf_attribute
|
||||||
#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_OMP_PREDETERMINED_SHARING
|
#undef LANG_HOOKS_OMP_PREDETERMINED_SHARING
|
||||||
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING cxx_omp_predetermined_sharing
|
#define LANG_HOOKS_OMP_PREDETERMINED_SHARING cxx_omp_predetermined_sharing
|
||||||
#undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
|
#undef LANG_HOOKS_OMP_CLAUSE_DEFAULT_CTOR
|
||||||
|
|
|
||||||
|
|
@ -20625,19 +20625,18 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
|
||||||
/* When we process the method declaration, we haven't seen
|
/* When we process the method declaration, we haven't seen
|
||||||
the out-of-class defaulted definition yet, so we have to
|
the out-of-class defaulted definition yet, so we have to
|
||||||
recheck now. */
|
recheck now. */
|
||||||
int defaulted = lang_hooks.decls.function_decl_defaulted (decl);
|
if ((dwarf_version >= 5 || ! dwarf_strict)
|
||||||
if (defaulted && (dwarf_version >= 5 || ! dwarf_strict)
|
|
||||||
&& !get_AT (subr_die, DW_AT_defaulted))
|
&& !get_AT (subr_die, DW_AT_defaulted))
|
||||||
switch (defaulted)
|
|
||||||
{
|
{
|
||||||
case 2:
|
int defaulted
|
||||||
add_AT_unsigned (subr_die, DW_AT_defaulted,
|
= lang_hooks.decls.decl_dwarf_attribute (decl,
|
||||||
DW_DEFAULTED_out_of_class);
|
DW_AT_defaulted);
|
||||||
break;
|
if (defaulted != -1)
|
||||||
|
{
|
||||||
case 1: /* This must have been handled before. */
|
/* Other values must have been handled before. */
|
||||||
default:
|
gcc_assert (defaulted == DW_DEFAULTED_out_of_class);
|
||||||
gcc_unreachable ();
|
add_AT_unsigned (subr_die, DW_AT_defaulted, defaulted);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20681,39 +20680,27 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
|
||||||
|
|
||||||
/* If this is an explicit function declaration then generate
|
/* If this is an explicit function declaration then generate
|
||||||
a DW_AT_explicit attribute. */
|
a DW_AT_explicit attribute. */
|
||||||
if (lang_hooks.decls.function_decl_explicit_p (decl)
|
if ((dwarf_version >= 3 || !dwarf_strict)
|
||||||
&& (dwarf_version >= 3 || !dwarf_strict))
|
&& lang_hooks.decls.decl_dwarf_attribute (decl,
|
||||||
|
DW_AT_explicit) == 1)
|
||||||
add_AT_flag (subr_die, DW_AT_explicit, 1);
|
add_AT_flag (subr_die, DW_AT_explicit, 1);
|
||||||
|
|
||||||
/* If this is a C++11 deleted special function member then generate
|
/* If this is a C++11 deleted special function member then generate
|
||||||
a DW_AT_deleted attribute. */
|
a DW_AT_deleted attribute. */
|
||||||
if (lang_hooks.decls.function_decl_deleted_p (decl)
|
if ((dwarf_version >= 5 || !dwarf_strict)
|
||||||
&& (dwarf_version >= 5 || ! dwarf_strict))
|
&& lang_hooks.decls.decl_dwarf_attribute (decl,
|
||||||
|
DW_AT_deleted) == 1)
|
||||||
add_AT_flag (subr_die, DW_AT_deleted, 1);
|
add_AT_flag (subr_die, DW_AT_deleted, 1);
|
||||||
|
|
||||||
/* If this is a C++11 defaulted special function member then
|
/* If this is a C++11 defaulted special function member then
|
||||||
generate a DW_AT_GNU_defaulted attribute. */
|
generate a DW_AT_GNU_defaulted attribute. */
|
||||||
int defaulted = lang_hooks.decls.function_decl_defaulted (decl);
|
if (dwarf_version >= 5 || !dwarf_strict)
|
||||||
if (defaulted && (dwarf_version >= 5 || ! dwarf_strict))
|
|
||||||
switch (defaulted)
|
|
||||||
{
|
{
|
||||||
case 1:
|
int defaulted
|
||||||
add_AT_unsigned (subr_die, DW_AT_defaulted,
|
= lang_hooks.decls.decl_dwarf_attribute (decl,
|
||||||
DW_DEFAULTED_in_class);
|
DW_AT_defaulted);
|
||||||
break;
|
if (defaulted != -1)
|
||||||
|
add_AT_unsigned (subr_die, DW_AT_defaulted, defaulted);
|
||||||
/* It is likely that this will never hit, since we
|
|
||||||
don't have the out-of-class definition yet when we
|
|
||||||
process the class definition and the method
|
|
||||||
declaration. We recheck elsewhere, but leave it
|
|
||||||
here just in case. */
|
|
||||||
case 2:
|
|
||||||
add_AT_unsigned (subr_die, DW_AT_defaulted,
|
|
||||||
DW_DEFAULTED_out_of_class);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
gcc_unreachable ();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ extern bool lhd_omp_mappable_type (tree);
|
||||||
|
|
||||||
extern const char *lhd_get_substring_location (const substring_loc &,
|
extern const char *lhd_get_substring_location (const substring_loc &,
|
||||||
location_t *out_loc);
|
location_t *out_loc);
|
||||||
|
extern int lhd_decl_dwarf_attribute (const_tree, int);
|
||||||
|
|
||||||
#define LANG_HOOKS_NAME "GNU unknown"
|
#define LANG_HOOKS_NAME "GNU unknown"
|
||||||
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
|
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
|
||||||
|
|
@ -214,9 +215,7 @@ extern tree lhd_make_node (enum tree_code);
|
||||||
#define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
|
#define LANG_HOOKS_GLOBAL_BINDINGS_P global_bindings_p
|
||||||
#define LANG_HOOKS_PUSHDECL pushdecl
|
#define LANG_HOOKS_PUSHDECL pushdecl
|
||||||
#define LANG_HOOKS_GETDECLS getdecls
|
#define LANG_HOOKS_GETDECLS getdecls
|
||||||
#define LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P hook_bool_const_tree_false
|
#define LANG_HOOKS_DECL_DWARF_ATTRIBUTE lhd_decl_dwarf_attribute
|
||||||
#define LANG_HOOKS_FUNCTION_DECL_DELETED_P hook_bool_const_tree_false
|
|
||||||
#define LANG_HOOKS_FUNCTION_DECL_DEFAULTED hook_int_const_tree_0
|
|
||||||
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
|
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL lhd_warn_unused_global_decl
|
||||||
#define LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS NULL
|
#define LANG_HOOKS_POST_COMPILATION_PARSING_CLEANUPS NULL
|
||||||
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
|
#define LANG_HOOKS_DECL_OK_FOR_SIBCALL lhd_decl_ok_for_sibcall
|
||||||
|
|
@ -237,9 +236,7 @@ extern tree lhd_make_node (enum tree_code);
|
||||||
LANG_HOOKS_GLOBAL_BINDINGS_P, \
|
LANG_HOOKS_GLOBAL_BINDINGS_P, \
|
||||||
LANG_HOOKS_PUSHDECL, \
|
LANG_HOOKS_PUSHDECL, \
|
||||||
LANG_HOOKS_GETDECLS, \
|
LANG_HOOKS_GETDECLS, \
|
||||||
LANG_HOOKS_FUNCTION_DECL_EXPLICIT_P, \
|
LANG_HOOKS_DECL_DWARF_ATTRIBUTE, \
|
||||||
LANG_HOOKS_FUNCTION_DECL_DELETED_P, \
|
|
||||||
LANG_HOOKS_FUNCTION_DECL_DEFAULTED, \
|
|
||||||
LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P, \
|
LANG_HOOKS_GENERIC_GENERIC_PARAMETER_DECL_P, \
|
||||||
LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P, \
|
LANG_HOOKS_FUNCTION_PARM_EXPANDED_FROM_PACK_P, \
|
||||||
LANG_HOOKS_GET_GENERIC_FUNCTION_DECL, \
|
LANG_HOOKS_GET_GENERIC_FUNCTION_DECL, \
|
||||||
|
|
|
||||||
|
|
@ -693,6 +693,15 @@ lhd_get_substring_location (const substring_loc &, location_t *)
|
||||||
return "unimplemented";
|
return "unimplemented";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Default implementation of LANG_HOOKS_DECL_DWARF_ATTRIBUTE. Don't add
|
||||||
|
any attributes. */
|
||||||
|
|
||||||
|
int
|
||||||
|
lhd_decl_dwarf_attribute (const_tree, int)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns true if the current lang_hooks represents the GNU C frontend. */
|
/* Returns true if the current lang_hooks represents the GNU C frontend. */
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -182,16 +182,9 @@ struct lang_hooks_for_decls
|
||||||
/* Returns the chain of decls so far in the current scope level. */
|
/* Returns the chain of decls so far in the current scope level. */
|
||||||
tree (*getdecls) (void);
|
tree (*getdecls) (void);
|
||||||
|
|
||||||
/* Returns true if DECL is explicit member function. */
|
/* Returns -1 if dwarf ATTR shouldn't be added for DECL, or the attribute
|
||||||
bool (*function_decl_explicit_p) (const_tree);
|
value otherwise. */
|
||||||
|
int (*decl_dwarf_attribute) (const_tree, int);
|
||||||
/* Returns true if DECL is C++11 deleted special member function. */
|
|
||||||
bool (*function_decl_deleted_p) (const_tree);
|
|
||||||
|
|
||||||
/* 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. */
|
|
||||||
int (*function_decl_defaulted) (const_tree);
|
|
||||||
|
|
||||||
/* Returns True if the parameter is a generic parameter decl
|
/* Returns True if the parameter is a generic parameter decl
|
||||||
of a generic type, e.g a template template parameter for the C++ FE. */
|
of a generic type, e.g a template template parameter for the C++ FE. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue