*fn = cand->fn;
/* Build the CALL_EXPR. */
- return build_over_call (cand, LOOKUP_NORMAL, complain);
+ tree ret = build_over_call (cand, LOOKUP_NORMAL, complain);
+
+ /* Set this flag for all callers of this function. In addition to
+ new-expressions, this is called for allocating coroutine state; treat
+ that as an implicit new-expression. */
+ tree call = extract_call_expr (ret);
+ if (TREE_CODE (call) == CALL_EXPR)
+ CALL_FROM_NEW_OR_DELETE_P (call) = 1;
+
+ return ret;
}
/* Build a new call to operator(). This may change ARGS. */
case VEC_NEW_EXPR:
case VEC_DELETE_EXPR:
case DELETE_EXPR:
- /* Use build_op_new_call and build_op_delete_call instead. */
+ /* Use build_operator_new_call and build_op_delete_call instead. */
gcc_unreachable ();
case CALL_EXPR:
if (DECL_DELETED_FN (fn) && alloc_fn)
return NULL_TREE;
+ tree ret;
if (placement)
{
/* The placement args might not be suitable for overload
argarray[i] = CALL_EXPR_ARG (placement, i);
if (!mark_used (fn, complain) && !(complain & tf_error))
return error_mark_node;
- return build_cxx_call (fn, nargs, argarray, complain);
+ ret = build_cxx_call (fn, nargs, argarray, complain);
}
else
{
complain);
}
- tree ret;
releasing_vec args;
args->quick_push (addr);
if (destroying)
args->quick_push (al);
}
ret = cp_build_function_call_vec (fn, &args, complain);
- return ret;
}
+
+ /* Set this flag for all callers of this function. In addition to
+ delete-expressions, this is called for deallocating coroutine state;
+ treat that as an implicit delete-expression. This is also called for
+ the delete if the constructor throws in a new-expression, and for a
+ deleting destructor (which implements a delete-expression). */
+ tree call = extract_call_expr (ret);
+ if (TREE_CODE (call) == CALL_EXPR)
+ CALL_FROM_NEW_OR_DELETE_P (call) = 1;
+
+ return ret;
}
/* [expr.new]
}
}
- tree alloc_call_expr = extract_call_expr (alloc_call);
- if (TREE_CODE (alloc_call_expr) == CALL_EXPR)
- CALL_FROM_NEW_OR_DELETE_P (alloc_call_expr) = 1;
-
if (cookie_size)
alloc_call = maybe_wrap_new_for_constexpr (alloc_call, elt_type,
cookie_size);
/*placement=*/NULL_TREE,
/*alloc_fn=*/NULL_TREE,
complain);
-
- tree deallocate_call_expr = extract_call_expr (deallocate_expr);
- if (TREE_CODE (deallocate_call_expr) == CALL_EXPR)
- CALL_FROM_NEW_OR_DELETE_P (deallocate_call_expr) = 1;
}
body = loop;
if (do_delete == error_mark_node)
return error_mark_node;
- else if (do_delete)
- {
- tree do_delete_call_expr = extract_call_expr (do_delete);
- if (TREE_CODE (do_delete_call_expr) == CALL_EXPR)
- CALL_FROM_NEW_OR_DELETE_P (do_delete_call_expr) = 1;
- }
if (do_delete && !TREE_SIDE_EFFECTS (expr))
expr = do_delete;
/* Return true when STMT is operator a replaceable delete call. */
bool
-gimple_call_replaceable_operator_delete_p (const gcall *stmt)
+gimple_call_operator_delete_p (const gcall *stmt)
{
tree fndecl;
if ((fndecl = gimple_call_fndecl (stmt)) != NULL_TREE)
- return DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (fndecl);
+ return DECL_IS_OPERATOR_DELETE_P (fndecl);
return false;
}
extern bool gimple_ior_addresses_taken (bitmap, gimple *);
extern bool gimple_builtin_call_types_compatible_p (const gimple *, tree);
extern combined_fn gimple_call_combined_fn (const gimple *);
-extern bool gimple_call_replaceable_operator_delete_p (const gcall *);
+extern bool gimple_call_operator_delete_p (const gcall *);
extern bool gimple_call_builtin_p (const gimple *);
extern bool gimple_call_builtin_p (const gimple *, enum built_in_class);
extern bool gimple_call_builtin_p (const gimple *, enum built_in_function);
return 0;
}
-/* { dg-final { scan-tree-dump-times "Deleting : operator delete" 1 "cddce1"} } */
+/* { dg-final { scan-tree-dump-not "Deleting : operator delete" "cddce1"} } */
/* { dg-final { scan-tree-dump-not "Deleting : B::operator delete" "cddce1"} } */
if (callee != NULL_TREE
&& (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (callee)
- || DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (callee))
+ || DECL_IS_OPERATOR_DELETE_P (callee))
&& gimple_call_from_new_or_delete (call))
return false;
}
bool is_delete_operator
= (is_gimple_call (stmt)
&& gimple_call_from_new_or_delete (as_a <gcall *> (stmt))
- && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt)));
+ && gimple_call_operator_delete_p (as_a <gcall *> (stmt)));
if (is_delete_operator
|| gimple_call_builtin_p (stmt, BUILT_IN_FREE))
{
if (callee != NULL_TREE
&& (DECL_IS_REPLACEABLE_OPERATOR_NEW_P (callee)
- || DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (callee))
+ || DECL_IS_OPERATOR_DELETE_P (callee))
&& gimple_call_from_new_or_delete (call))
continue;
&& (gimple_call_builtin_p (stmt, BUILT_IN_FREE)
|| (is_gimple_call (stmt)
&& gimple_call_from_new_or_delete (as_a <gcall *> (stmt))
- && gimple_call_replaceable_operator_delete_p (as_a <gcall *> (stmt)))))
+ && gimple_call_operator_delete_p (as_a <gcall *> (stmt)))))
{
tree ptr = gimple_call_arg (stmt, 0);
if (TREE_CODE (ptr) == SSA_NAME)
such operator, then the effects for PTA (in particular
the escaping of the pointer) can be ignored. */
else if (fndecl
- && DECL_IS_REPLACEABLE_OPERATOR_DELETE_P (fndecl)
+ && DECL_IS_OPERATOR_DELETE_P (fndecl)
&& gimple_call_from_new_or_delete (t))
;
else
#define DECL_IS_OPERATOR_DELETE_P(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.decl_type == OPERATOR_DELETE)
-#define DECL_IS_REPLACEABLE_OPERATOR_DELETE_P(NODE) \
- (DECL_IS_OPERATOR_DELETE_P (NODE) && DECL_IS_REPLACEABLE_OPERATOR (NODE))
-
#define DECL_SET_IS_OPERATOR_DELETE(NODE, VAL) \
set_function_decl_type (FUNCTION_DECL_CHECK (NODE), OPERATOR_DELETE, VAL)