diff options
author | Martin Liska <mliska@suse.cz> | 2019-07-25 11:36:19 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-07-25 09:36:19 +0000 |
commit | cb50701ec2c7abdc48db278802022f7e94675d07 (patch) | |
tree | 73041813c838f6762515bdf6c86421963bb193b1 /gcc/tree.h | |
parent | 982b149787057bb288caed389f231c4979e969dc (diff) | |
download | gcc-cb50701ec2c7abdc48db278802022f7e94675d07.zip gcc-cb50701ec2c7abdc48db278802022f7e94675d07.tar.gz gcc-cb50701ec2c7abdc48db278802022f7e94675d07.tar.bz2 |
Come up with function_decl_type and use it in tree_function_decl.
2019-07-25 Martin Liska <mliska@suse.cz>
* calls.c (maybe_warn_alloc_args_overflow): Use new macros
(e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
* coverage.c (coverage_begin_function): Likewise.
* fold-const.c (tree_expr_nonzero_warnv_p): Likewise.
* gimple.c (gimple_call_nonnull_result_p): Likewise.
* ipa-icf.c (sem_item::compare_referenced_symbol_properties): Likewise.
(sem_item::hash_referenced_symbol_properties): Likewise.
* lto-streamer-out.c (hash_tree): Likewise.
* predict.c (expr_expected_value_1): Likewise.
* tree-inline.c (expand_call_inline): Likewise.
* tree-streamer-in.c (unpack_ts_function_decl_value_fields): Likewise.
* tree-streamer-out.c (pack_ts_function_decl_value_fields): Likewise.
* tree-core.h (enum function_decl_type): New enum.
(struct tree_function_decl): Remove operator_new_flag and lambda_function.
* tree.h (FUNCTION_DECL_DECL_TYPE): New.
(set_function_decl_type): Likewise.
(DECL_IS_OPERATOR_NEW_P): New.
(DECL_SET_IS_OPERATOR_NEW): Likewise.
(DECL_LAMBDA_FUNCTION): Likewise.
(DECL_LAMBDA_FUNCTION_P): Likewise.
(DECL_IS_OPERATOR_NEW): Remove.
(DECL_SET_LAMBDA_FUNCTION): Likewise.
2019-07-25 Martin Liska <mliska@suse.cz>
* c-decl.c (merge_decls): Use new macros
(e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
2019-07-25 Martin Liska <mliska@suse.cz>
* decl.c (duplicate_decls): Use new macros
(e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
(cxx_init_decl_processing): Likewise.
(grok_op_properties): Likewise.
* parser.c (cp_parser_lambda_declarator_opt): Likewise.
2019-07-25 Martin Liska <mliska@suse.cz>
* lto-common.c (compare_tree_sccs_1): Use new macros
(e.g. DECL_SET_LAMBDA_FUNCTION and DECL_LAMBDA_FUNCTION_P).
From-SVN: r273790
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 34 |
1 files changed, 30 insertions, 4 deletions
@@ -2994,11 +2994,34 @@ extern void decl_fini_priority_insert (tree, priority_type); #define DECL_IS_MALLOC(NODE) \ (FUNCTION_DECL_CHECK (NODE)->function_decl.malloc_flag) +/* Macro for direct set and get of function_decl.decl_type. */ +#define FUNCTION_DECL_DECL_TYPE(NODE) \ + (NODE->function_decl.decl_type) + +/* Set decl_type of a DECL. Set it to T when SET is true, or reset + it to NONE. */ + +static inline void +set_function_decl_type (tree decl, function_decl_type t, bool set) +{ + if (set) + { + gcc_assert (FUNCTION_DECL_DECL_TYPE (decl) == NONE + || FUNCTION_DECL_DECL_TYPE (decl) == t); + decl->function_decl.decl_type = t; + } + else if (FUNCTION_DECL_DECL_TYPE (decl) == t) + FUNCTION_DECL_DECL_TYPE (decl) = NONE; +} + /* Nonzero in a FUNCTION_DECL means this function should be treated as C++ operator new, meaning that it returns a pointer for which we should not use type based aliasing. */ -#define DECL_IS_OPERATOR_NEW(NODE) \ - (FUNCTION_DECL_CHECK (NODE)->function_decl.operator_new_flag) +#define DECL_IS_OPERATOR_NEW_P(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == OPERATOR_NEW) + +#define DECL_SET_IS_OPERATOR_NEW(NODE, VAL) \ + set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_NEW, VAL) /* Nonzero in a FUNCTION_DECL means this function may return more than once. */ @@ -3143,8 +3166,11 @@ extern vec<tree, va_gc> **decl_debug_args_insert (tree); (FUNCTION_DECL_CHECK (NODE)->decl_with_vis.cxx_destructor) /* In FUNCTION_DECL, this is set if this function is a lambda function. */ -#define DECL_LAMBDA_FUNCTION(NODE) \ - (FUNCTION_DECL_CHECK (NODE)->function_decl.lambda_function) +#define DECL_LAMBDA_FUNCTION_P(NODE) \ + (FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == LAMBDA_FUNCTION) + +#define DECL_SET_LAMBDA_FUNCTION(NODE, VAL) \ + set_function_decl_type (FUNCTION_DECL_CHECK (NODE), LAMBDA_FUNCTION, VAL) /* In FUNCTION_DECL that represent an virtual method this is set when the method is final. */ |