tree full_type;
tree nelts = NULL_TREE;
tree alloc_call, alloc_expr, alloc_node;
+ tree alloc_fn;
tree cookie_expr, init_expr;
int has_array = 0;
enum tree_code code;
if (alloc_call == error_mark_node)
return error_mark_node;
- /* The ALLOC_CALL should be a CALL_EXPR, and the first operand
- should be the address of a known FUNCTION_DECL. */
- my_friendly_assert (TREE_CODE (alloc_call) == CALL_EXPR, 20000521);
- t = TREE_OPERAND (alloc_call, 0);
- my_friendly_assert (TREE_CODE (t) == ADDR_EXPR, 20000521);
- t = TREE_OPERAND (t, 0);
- my_friendly_assert (TREE_CODE (t) == FUNCTION_DECL, 20000521);
+ /* The ALLOC_CALL should be a CALL_EXPR -- or a COMPOUND_EXPR whose
+ right-hand-side is ultimately a CALL_EXPR -- and the first
+ operand should be the address of a known FUNCTION_DECL. */
+ t = alloc_call;
+ while (TREE_CODE (t) == COMPOUND_EXPR)
+ t = TREE_OPERAND (t, 1);
+ alloc_fn = get_callee_fndecl (t);
+ my_friendly_assert (alloc_fn != NULL_TREE, 20020325);
/* Now, check to see if this function is actually a placement
allocation function. This can happen even when PLACEMENT is NULL
because we might have something like:
one argument, or there are variable arguments, then this is a
placement allocation function. */
placement_allocation_fn_p
- = (type_num_arguments (TREE_TYPE (t)) > 1 || varargs_function_p (t));
+ = (type_num_arguments (TREE_TYPE (alloc_fn)) > 1
+ || varargs_function_p (alloc_fn));
/* unless an allocation function is declared with an empty excep-
tion-specification (_except.spec_), throw(), it indicates failure to
So check for a null exception spec on the op new we just called. */
- /* The ADDR_EXPR. */
- t = TREE_OPERAND (alloc_call, 0);
- /* The function. */
- t = TREE_OPERAND (t, 0);
- nothrow = TYPE_NOTHROW_P (TREE_TYPE (t));
+ nothrow = TYPE_NOTHROW_P (TREE_TYPE (alloc_fn));
check_new = (flag_check_new || nothrow) && ! use_java_new;
alloc_expr = alloc_call;