aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-10-31 12:50:19 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-10-31 12:50:19 +0000
commit137073d34a47fe14f97e35f69d3941b2ef0bb5c1 (patch)
treef744b2bf587a0a0316bd56618e284cc04aa509f4 /gcc/cp/lambda.c
parent8a3f457f148b7114dfa37927b73410eecc986a33 (diff)
downloadgcc-137073d34a47fe14f97e35f69d3941b2ef0bb5c1.zip
gcc-137073d34a47fe14f97e35f69d3941b2ef0bb5c1.tar.gz
gcc-137073d34a47fe14f97e35f69d3941b2ef0bb5c1.tar.bz2
[C++ PATCH] overloaded operator fns [1/N]
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg02315.html * cp-tree.h (assign_op_identifier, call_op_identifier): Define. (LAMBDA_FUNCTION_P): Use DECL_OVERLOADED_OPERATOR_IS. (DECL_OVERLOADED_OPERATOR_P): Just retuurn true/false. (DECL_OVERLOADED_OPERATOR_CODE, DECL_OVERLOADED_OPERATOR_IS): Define. * call.c (add_function_candidate): Use DECL_OVERLOADED_OPERATOR_IS. (build_op_call_1): Use call_op_identifier & DECL_OVERLOADED_OPERATOR_IS. (build_over_call): Likewise. (has_trivial_copy_assign_p): Use assign_op_identifier. (build_special_member_call): Likewise. * class.c (dfs_declare_virt_assop_and_dtor): Likewise. (vbase_has_user_provided_move_assign, classtype_has_move_assign_or_move_ctor_p): Likewise. * decl.c (duplicate_decls): Use DECL_OVERLOADED_OPERATOR_CODE. (grok_special_member_properties): Use assign_op_identifier. (start_preparsed_function): Use DECL_OVERLOADED_OPERATOR_IS. * decl2.c (mark_used): Use DECL_CONV_FN_P. * dump.c (dump_access): Delete prototype. (dump_op): Delete. (cp_dump_tree): Don't call it. * lambda.c (lambda_function): Use call_op_identifier. (maybe_add_lambda_conv_op): Not an overloaded operator. Remove unneeded braces. * mangle.c (write_unqualified_name): Use DECL_OVERLOADED_OPERTOR_CODE. * method.c (do_build_copy_assign): Use assign_op_identifier. (synthesize_method): Use DECL_OVERLOADED_OPERATOR_IS. (get_copy_assign): Use assign_op_identifier. (synthesized_method_walk): Likewise. (defaultable_fn_check): Use DECL_OVERLOADED_OPERATOR_IS. * parser.c (cp_parser_lambda_declarator_opt): Use call_op_identifier. * semanitics.c (classtype_has_nothrow_assign_or_copy_p): Use assign_op_identifier. * tree.c (special_function_p): Use DECL_OVERLOADED_OPERATOR_IS. * typeck.c (check_return_expr): Use DECL_OVERLOADED_OPERATOR_CODE. (check_return_expr): Use assign_op_identifier. From-SVN: r254263
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 76f2f29..bb6c68a 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -201,7 +201,7 @@ lambda_function (tree lambda)
if (CLASSTYPE_TEMPLATE_INSTANTIATION (type)
&& !COMPLETE_OR_OPEN_TYPE_P (type))
return NULL_TREE;
- lambda = lookup_member (type, cp_operator_id (CALL_EXPR),
+ lambda = lookup_member (type, call_op_identifier,
/*protect=*/0, /*want_type=*/false,
tf_warning_or_error);
if (lambda)
@@ -1258,7 +1258,6 @@ maybe_add_lambda_conv_op (tree type)
tree fn = convfn;
DECL_SOURCE_LOCATION (fn) = DECL_SOURCE_LOCATION (callop);
SET_DECL_ALIGN (fn, MINIMUM_METHOD_BOUNDARY);
- SET_OVERLOADED_OPERATOR_CODE (fn, TYPE_EXPR);
grokclassfn (type, fn, NO_SPECIAL);
set_linkage_according_to_type (type, fn);
rest_of_decl_compilation (fn, namespace_bindings_p (), at_eof);
@@ -1312,11 +1311,9 @@ maybe_add_lambda_conv_op (tree type)
fn = add_inherited_template_parms (fn, DECL_TI_TEMPLATE (callop));
if (flag_sanitize & SANITIZE_NULL)
- {
- /* Don't UBsan this function; we're deliberately calling op() with a null
- object argument. */
- add_no_sanitize_value (fn, SANITIZE_UNDEFINED);
- }
+ /* Don't UBsan this function; we're deliberately calling op() with a null
+ object argument. */
+ add_no_sanitize_value (fn, SANITIZE_UNDEFINED);
add_method (type, fn, false);