summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-16 22:29:52 +0000
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-16 22:29:52 +0000
commit389dd41bd043170e7dc7660304f14a5f16af3562 (patch)
treee4de0ffc0a0ca77f35b03bf9e8a248a4b5735f6a /gcc/cp
parentc1c67b4f5041c4367842002c81ffe912ff97f2d8 (diff)
downloadgcc-389dd41bd043170e7dc7660304f14a5f16af3562.tar.gz
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org> PR 40435 * tree-complex.c, tree-loop-distribution.c, tree.c, tree.h, builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c, calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, tree-inline.c, c-common.c, c-common.h, gimple.c, tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c, convert.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. objc/ * objc-act.c: Add location argument to all calls to build_fold_addr_expr. testsuite/ * gcc.dg/pr36902.c: Add column info. * g++.dg/gcov/gcov-2.C: Change count for definition. cp/ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c, tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c, call.c, cvt.c, mangle.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. fortran/ * trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c, trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149722 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/call.c8
-rw-r--r--gcc/cp/class.c61
-rw-r--r--gcc/cp/cp-gimplify.c8
-rw-r--r--gcc/cp/cvt.c9
-rw-r--r--gcc/cp/cxx-pretty-print.c3
-rw-r--r--gcc/cp/error.c3
-rw-r--r--gcc/cp/except.c3
-rw-r--r--gcc/cp/init.c25
-rw-r--r--gcc/cp/mangle.c8
-rw-r--r--gcc/cp/method.c14
-rw-r--r--gcc/cp/pt.c9
-rw-r--r--gcc/cp/rtti.c6
-rw-r--r--gcc/cp/semantics.c9
-rw-r--r--gcc/cp/tree.c6
-rw-r--r--gcc/cp/typeck.c16
16 files changed, 132 insertions, 74 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 81cc8e0f646..71d2105f08b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,21 @@
+2009-07-17 Aldy Hernandez <aldyh@redhat.com>
+ Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR 40435
+ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c,
+ tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c,
+ call.c, cvt.c, mangle.c: Add location argument to
+ fold_{unary,binary,ternary}, fold_build[123], build_call_expr,
+ build_size_arg, build_fold_addr_expr, build_call_array,
+ non_lvalue, size_diffop, fold_build1_initializer,
+ fold_build2_initializer, fold_build3_initializer,
+ fold_build_call_array, fold_build_call_array_initializer,
+ fold_single_bit_test, omit_one_operand, omit_two_operands,
+ invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref,
+ fold_indirect_ref, combine_comparisons, fold_builtin_*,
+ fold_call_expr, build_range_check, maybe_fold_offset_to_address,
+ round_up, round_down.
+
2009-07-16 Jason Merrill <jason@redhat.com>
PR libstdc++/37907
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 6a7a1b861a0..f4b5b02bb45 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -362,7 +362,8 @@ build_call_a (tree function, int n, tree *argarray)
argarray[i], t);
}
- function = build_call_array (result_type, function, n, argarray);
+ function = build_call_array_loc (input_location,
+ result_type, function, n, argarray);
TREE_HAS_CONSTRUCTOR (function) = is_constructor;
TREE_NOTHROW (function) = nothrow;
@@ -5365,8 +5366,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
alcarray[ix + 1] = arg;
argarray = alcarray;
}
- expr = build_call_array (return_type, build_addr_func (fn), nargs,
- argarray);
+ expr = build_call_array_loc (input_location,
+ return_type, build_addr_func (fn), nargs,
+ argarray);
if (TREE_THIS_VOLATILE (fn) && cfun)
current_function_returns_abnormally = 1;
if (!VOID_TYPE_P (return_type))
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 373f4578190..9a768831621 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -333,7 +333,7 @@ build_base_path (enum tree_code code,
if (null_test)
{
tree zero = cp_convert (TREE_TYPE (expr), integer_zero_node);
- null_test = fold_build2 (NE_EXPR, boolean_type_node,
+ null_test = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
expr, zero);
}
@@ -385,7 +385,7 @@ build_base_path (enum tree_code code,
TREE_CONSTANT (v_offset) = 1;
offset = convert_to_integer (ptrdiff_type_node,
- size_diffop (offset,
+ size_diffop_loc (input_location, offset,
BINFO_OFFSET (v_binfo)));
if (!integer_zerop (offset))
@@ -417,7 +417,7 @@ build_base_path (enum tree_code code,
{
offset = fold_convert (sizetype, offset);
if (code == MINUS_EXPR)
- offset = fold_build1 (NEGATE_EXPR, sizetype, offset);
+ offset = fold_build1_loc (input_location, NEGATE_EXPR, sizetype, offset);
expr = build2 (POINTER_PLUS_EXPR, ptr_target_type, expr, offset);
}
else
@@ -428,8 +428,8 @@ build_base_path (enum tree_code code,
out:
if (null_test)
- expr = fold_build3 (COND_EXPR, target_type, null_test, expr,
- fold_build1 (NOP_EXPR, target_type,
+ expr = fold_build3_loc (input_location, COND_EXPR, target_type, null_test, expr,
+ fold_build1_loc (input_location, NOP_EXPR, target_type,
integer_zero_node));
return expr;
@@ -553,10 +553,11 @@ convert_to_base_statically (tree expr, tree base)
expr = cp_build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1,
tf_warning_or_error);
if (!integer_zerop (BINFO_OFFSET (base)))
- expr = fold_build2 (POINTER_PLUS_EXPR, pointer_type, expr,
+ expr = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, pointer_type, expr,
fold_convert (sizetype, BINFO_OFFSET (base)));
expr = fold_convert (build_pointer_type (BINFO_TYPE (base)), expr);
- expr = build_fold_indirect_ref (expr);
+ expr = build_fold_indirect_ref_loc (input_location, expr);
}
return expr;
@@ -1396,7 +1397,8 @@ determine_primary_bases (tree t)
/* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a
primary base, make sure the offsets match. */
- delta = size_diffop (convert (ssizetype,
+ delta = size_diffop_loc (input_location,
+ convert (ssizetype,
BINFO_OFFSET (base_binfo)),
convert (ssizetype,
BINFO_OFFSET (this_primary)));
@@ -1459,7 +1461,7 @@ determine_primary_bases (tree t)
/* A virtual binfo might have been copied from within
another hierarchy. As we're about to use it as a primary
base, make sure the offsets match. */
- delta = size_diffop (ssize_int (0),
+ delta = size_diffop_loc (input_location, ssize_int (0),
convert (ssizetype, BINFO_OFFSET (primary)));
propagate_binfo_offsets (primary, delta);
@@ -2162,9 +2164,10 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
{
/* We convert via virtual base. Adjust the fixed
offset to be from there. */
- offset = size_diffop
- (offset, convert
- (ssizetype, BINFO_OFFSET (virtual_offset)));
+ offset =
+ size_diffop (offset,
+ convert (ssizetype,
+ BINFO_OFFSET (virtual_offset)));
}
if (fixed_offset)
/* There was an existing fixed offset, this must be
@@ -2247,7 +2250,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
if (virtual_base)
/* The `this' pointer needs to be adjusted from the declaration to
the nearest virtual base. */
- delta = size_diffop (convert (ssizetype, BINFO_OFFSET (virtual_base)),
+ delta = size_diffop_loc (input_location,
+ convert (ssizetype, BINFO_OFFSET (virtual_base)),
convert (ssizetype, BINFO_OFFSET (first_defn)));
else if (lost)
/* If the nearest definition is in a lost primary, we don't need an
@@ -2260,7 +2264,8 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
BINFO to pointing at the base where the final overrider
appears. */
virtual_covariant:
- delta = size_diffop (convert (ssizetype,
+ delta = size_diffop_loc (input_location,
+ convert (ssizetype,
BINFO_OFFSET (TREE_VALUE (overrider))),
convert (ssizetype, BINFO_OFFSET (binfo)));
@@ -3574,7 +3579,8 @@ layout_nonempty_base_or_field (record_layout_info rli,
hierarchy. Therefore, we may not need to add the entire
OFFSET. */
propagate_binfo_offsets (binfo,
- size_diffop (convert (ssizetype, offset),
+ size_diffop_loc (input_location,
+ convert (ssizetype, offset),
convert (ssizetype,
BINFO_OFFSET (binfo))));
}
@@ -3611,7 +3617,8 @@ layout_empty_base (record_layout_info rli, tree binfo,
{
if (abi_version_at_least (2))
propagate_binfo_offsets
- (binfo, size_diffop (size_zero_node, BINFO_OFFSET (binfo)));
+ (binfo, size_diffop_loc (input_location,
+ size_zero_node, BINFO_OFFSET (binfo)));
else
warning (OPT_Wabi,
"offset of empty base %qT may not be ABI-compliant and may"
@@ -3717,7 +3724,8 @@ build_base_field (record_layout_info rli, tree binfo,
/* On some platforms (ARM), even empty classes will not be
byte-aligned. */
- eoc = round_up (rli_size_unit_so_far (rli),
+ eoc = round_up_loc (input_location,
+ rli_size_unit_so_far (rli),
CLASSTYPE_ALIGN_UNIT (basetype));
atend = layout_empty_base (rli, binfo, eoc, offsets);
/* A nearly-empty class "has no proper base class that is empty,
@@ -4637,7 +4645,8 @@ layout_virtual_bases (record_layout_info rli, splay_tree offsets)
&& first_vbase
&& (tree_int_cst_lt
(size_binop (CEIL_DIV_EXPR,
- round_up (CLASSTYPE_SIZE (t),
+ round_up_loc (input_location,
+ CLASSTYPE_SIZE (t),
CLASSTYPE_ALIGN (basetype)),
bitsize_unit_node),
BINFO_OFFSET (vbase))))
@@ -5070,7 +5079,7 @@ layout_class_type (tree t, tree *virtuals_p)
/* Make sure that we are on a byte boundary so that the size of
the class without virtual bases will always be a round number
of bytes. */
- rli->bitpos = round_up (rli->bitpos, BITS_PER_UNIT);
+ rli->bitpos = round_up_loc (input_location, rli->bitpos, BITS_PER_UNIT);
normalize_rli (rli);
}
@@ -7765,11 +7774,12 @@ build_vbase_offset_vtbl_entries (tree binfo, vtbl_init_data* vid)
The vbase offsets go in reverse inheritance-graph order, and
we are walking in inheritance graph order so these end up in
the right order. */
- delta = size_diffop (BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
+ delta = size_diffop_loc (input_location,
+ BINFO_OFFSET (b), BINFO_OFFSET (non_primary_binfo));
*vid->last_init
= build_tree_list (NULL_TREE,
- fold_build1 (NOP_EXPR,
+ fold_build1_loc (input_location, NOP_EXPR,
vtable_entry_type,
delta));
vid->last_init = &TREE_CHAIN (*vid->last_init);
@@ -7999,9 +8009,11 @@ add_vcall_offset (tree orig_fn, tree binfo, vtbl_init_data *vid)
vid->binfo. But it might be a lost primary, so its
BINFO_OFFSET might be wrong, so we just use the
BINFO_OFFSET from vid->binfo. */
- vcall_offset = size_diffop (BINFO_OFFSET (base),
+ vcall_offset = size_diffop_loc (input_location,
+ BINFO_OFFSET (base),
BINFO_OFFSET (vid->binfo));
- vcall_offset = fold_build1 (NOP_EXPR, vtable_entry_type,
+ vcall_offset = fold_build1_loc (input_location,
+ NOP_EXPR, vtable_entry_type,
vcall_offset);
}
/* Add the initializer to the vtable. */
@@ -8040,7 +8052,8 @@ build_rtti_vtbl_entries (tree binfo, vtbl_init_data* vid)
&& BINFO_INHERITANCE_CHAIN (primary_base) == b);
b = primary_base;
}
- offset = size_diffop (BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
+ offset = size_diffop_loc (input_location,
+ BINFO_OFFSET (vid->rtti_binfo), BINFO_OFFSET (b));
/* The second entry is the address of the typeinfo object. */
if (flag_rtti)
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index fc30c06b62f..4cf78dfd4a5 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -924,9 +924,9 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
size_zero_node, NULL, NULL);
}
while (TREE_CODE (inner_type) == ARRAY_TYPE);
- start1 = build_fold_addr_expr (start1);
+ start1 = build_fold_addr_expr_loc (input_location, start1);
if (arg2)
- start2 = build_fold_addr_expr (start2);
+ start2 = build_fold_addr_expr_loc (input_location, start2);
end1 = TYPE_SIZE_UNIT (TREE_TYPE (arg1));
end1 = build2 (POINTER_PLUS_EXPR, TREE_TYPE (start1), start1, end1);
@@ -980,9 +980,9 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2)
}
else
{
- argarray[i++] = build_fold_addr_expr (arg1);
+ argarray[i++] = build_fold_addr_expr_loc (input_location, arg1);
if (arg2)
- argarray[i++] = build_fold_addr_expr (arg2);
+ argarray[i++] = build_fold_addr_expr_loc (input_location, arg2);
/* Handle default arguments. */
for (parm = defparm; parm && parm != void_list_node;
parm = TREE_CHAIN (parm), i++)
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 88ae05a0e61..c42d21cb3cd 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -936,10 +936,11 @@ convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
&& !AGGR_INIT_VIA_CTOR_P (init))
{
tree fn = AGGR_INIT_EXPR_FN (init);
- expr = build_call_array (TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
- fn,
- aggr_init_expr_nargs (init),
- AGGR_INIT_EXPR_ARGP (init));
+ expr = build_call_array_loc (input_location,
+ TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
+ fn,
+ aggr_init_expr_nargs (init),
+ AGGR_INIT_EXPR_ARGP (init));
}
}
break;
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 0b13bc1eb8d..1d7f9cf2caf 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -659,7 +659,8 @@ pp_cxx_new_expression (cxx_pretty_printer *pp, tree t)
if (TREE_CODE (type) == ARRAY_REF)
type = build_cplus_array_type
(TREE_OPERAND (type, 0),
- build_index_type (fold_build2 (MINUS_EXPR, integer_type_node,
+ build_index_type (fold_build2_loc (input_location,
+ MINUS_EXPR, integer_type_node,
TREE_OPERAND (type, 1),
integer_one_node)));
pp_cxx_type_id (pp, type);
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index a0ba51a6ceb..939400bd2c4 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -770,7 +770,8 @@ dump_type_suffix (tree t, int flags)
dump_expr (TREE_OPERAND (max, 0),
flags & ~TFF_EXPR_IN_PARENS);
else
- dump_expr (fold_build2 (PLUS_EXPR, dtype, max,
+ dump_expr (fold_build2_loc (input_location,
+ PLUS_EXPR, dtype, max,
build_int_cst (dtype, 1)),
flags & ~TFF_EXPR_IN_PARENS);
}
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 01512860725..fdef154f5d1 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -450,7 +450,8 @@ expand_start_catch_block (tree decl)
exp = build_exc_ptr ();
exp = build1 (NOP_EXPR, build_pointer_type (type), exp);
exp = build2 (POINTER_PLUS_EXPR, TREE_TYPE (exp), exp,
- fold_build1 (NEGATE_EXPR, sizetype,
+ fold_build1_loc (input_location,
+ NEGATE_EXPR, sizetype,
TYPE_SIZE_UNIT (TREE_TYPE (exp))));
exp = cp_build_indirect_ref (exp, NULL, tf_warning_or_error);
initialize_handler_parm (decl, exp);
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 9118c61928b..73403e9113a 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -219,7 +219,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
/* Iterate over the array elements, building initializations. */
if (nelts)
- max_index = fold_build2 (MINUS_EXPR, TREE_TYPE (nelts),
+ max_index = fold_build2_loc (input_location,
+ MINUS_EXPR, TREE_TYPE (nelts),
nelts, integer_one_node);
else
max_index = array_type_nelts (type);
@@ -965,7 +966,8 @@ expand_cleanup_for_base (tree binfo, tree flag)
LOOKUP_NORMAL | LOOKUP_NONVIRTUAL,
tf_warning_or_error);
if (flag)
- expr = fold_build3 (COND_EXPR, void_type_node,
+ expr = fold_build3_loc (input_location,
+ COND_EXPR, void_type_node,
c_common_truthvalue_conversion (input_location, flag),
expr, integer_zero_node);
@@ -2048,7 +2050,8 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts,
many elements to destroy later. We use the last sizeof
(size_t) bytes to store the number of elements. */
cookie_ptr = size_binop (MINUS_EXPR, cookie_size, size_in_bytes (sizetype));
- cookie_ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (alloc_node),
+ cookie_ptr = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, TREE_TYPE (alloc_node),
alloc_node, cookie_ptr);
size_ptr_type = build_pointer_type (sizetype);
cookie_ptr = fold_convert (size_ptr_type, cookie_ptr);
@@ -2060,7 +2063,8 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts,
{
/* Also store the element size. */
cookie_ptr = build2 (POINTER_PLUS_EXPR, size_ptr_type, cookie_ptr,
- fold_build1 (NEGATE_EXPR, sizetype,
+ fold_build1_loc (input_location,
+ NEGATE_EXPR, sizetype,
size_in_bytes (sizetype)));
cookie = cp_build_indirect_ref (cookie_ptr, NULL, complain);
@@ -2498,7 +2502,8 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
tbase = create_temporary_var (ptype);
tbase_init = cp_build_modify_expr (tbase, NOP_EXPR,
- fold_build2 (POINTER_PLUS_EXPR, ptype,
+ fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, ptype,
fold_convert (ptype, base),
virtual_size),
tf_warning_or_error);
@@ -2510,7 +2515,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
body = build1 (EXIT_EXPR, void_type_node,
build2 (EQ_EXPR, boolean_type_node, tbase,
fold_convert (ptype, base)));
- tmp = fold_build1 (NEGATE_EXPR, sizetype, size_exp);
+ tmp = fold_build1_loc (input_location, NEGATE_EXPR, sizetype, size_exp);
body = build_compound_expr
(input_location,
body, cp_build_modify_expr (tbase, NOP_EXPR,
@@ -2575,8 +2580,9 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
body = integer_zero_node;
/* Outermost wrapper: If pointer is null, punt. */
- body = fold_build3 (COND_EXPR, void_type_node,
- fold_build2 (NE_EXPR, boolean_type_node, base,
+ body = fold_build3_loc (input_location, COND_EXPR, void_type_node,
+ fold_build2_loc (input_location,
+ NE_EXPR, boolean_type_node, base,
convert (TREE_TYPE (base),
integer_zero_node)),
body, integer_zero_node);
@@ -3279,7 +3285,8 @@ build_vec_delete (tree base, tree maxindex,
base = TARGET_EXPR_SLOT (base_init);
}
type = strip_array_types (TREE_TYPE (type));
- cookie_addr = fold_build1 (NEGATE_EXPR, sizetype, TYPE_SIZE_UNIT (sizetype));
+ cookie_addr = fold_build1_loc (input_location, NEGATE_EXPR,
+ sizetype, TYPE_SIZE_UNIT (sizetype));
cookie_addr = build2 (POINTER_PLUS_EXPR,
size_ptr_type,
fold_convert (size_ptr_type, base),
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index c49439d0e07..1c79dcc3174 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1264,16 +1264,16 @@ write_integer_cst (const tree cst)
if (sign < 0)
{
write_char ('n');
- n = fold_build1 (NEGATE_EXPR, type, n);
+ n = fold_build1_loc (input_location, NEGATE_EXPR, type, n);
}
do
{
- tree d = fold_build2 (FLOOR_DIV_EXPR, type, n, base);
- tree tmp = fold_build2 (MULT_EXPR, type, d, base);
+ tree d = fold_build2_loc (input_location, FLOOR_DIV_EXPR, type, n, base);
+ tree tmp = fold_build2_loc (input_location, MULT_EXPR, type, d, base);
unsigned c;
done = integer_zerop (d);
- tmp = fold_build2 (MINUS_EXPR, type, n, tmp);
+ tmp = fold_build2_loc (input_location, MINUS_EXPR, type, n, tmp);
c = hwint_to_ascii (TREE_INT_CST_LOW (tmp), 10, ptr,
done ? 1 : chunk_digits);
ptr -= c;
diff --git a/gcc/cp/method.c b/gcc/cp/method.c
index 4e22a208510..c1da08b690f 100644
--- a/gcc/cp/method.c
+++ b/gcc/cp/method.c
@@ -221,7 +221,8 @@ thunk_adjust (tree ptr, bool this_adjusting,
{
if (this_adjusting)
/* Adjust the pointer by the constant. */
- ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
+ ptr = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
size_int (fixed_offset));
/* If there's a virtual offset, look up that value in the vtable and
@@ -239,18 +240,21 @@ thunk_adjust (tree ptr, bool this_adjusting,
/* Form the vtable address. */
vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable);
/* Find the entry with the vcall offset. */
- vtable = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtable), vtable,
- fold_convert (sizetype, virtual_offset));
+ vtable = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, TREE_TYPE (vtable), vtable,
+ fold_convert (sizetype, virtual_offset));
/* Get the offset itself. */
vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable);
/* Adjust the `this' pointer. */
- ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
+ ptr = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
fold_convert (sizetype, vtable));
}
if (!this_adjusting)
/* Adjust the pointer by the constant. */
- ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
+ ptr = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr,
size_int (fixed_offset));
return ptr;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 68250c2aff2..de9f828c645 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9850,7 +9850,8 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (e1 == error_mark_node || e2 == error_mark_node)
return error_mark_node;
- return fold_build2 (TREE_CODE (t), TREE_TYPE (t), e1, e2);
+ return fold_build2_loc (input_location,
+ TREE_CODE (t), TREE_TYPE (t), e1, e2);
}
case NEGATE_EXPR:
@@ -9860,7 +9861,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
if (e == error_mark_node)
return error_mark_node;
- return fold_build1 (TREE_CODE (t), TREE_TYPE (t), e);
+ return fold_build1_loc (input_location, TREE_CODE (t), TREE_TYPE (t), e);
}
case TYPENAME_TYPE:
@@ -14073,12 +14074,12 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
/* If only one of the bounds used a MINUS_EXPR, compensate
by adding one to the other bound. */
if (parm_cst && !arg_cst)
- parm_max = fold_build2 (PLUS_EXPR,
+ parm_max = fold_build2_loc (input_location, PLUS_EXPR,
integer_type_node,
parm_max,
integer_one_node);
else if (arg_cst && !parm_cst)
- arg_max = fold_build2 (PLUS_EXPR,
+ arg_max = fold_build2_loc (input_location, PLUS_EXPR,
integer_type_node,
arg_max,
integer_one_node);
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index c78d92be09b..01bba3477df 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1099,9 +1099,11 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
/* Combine offset and flags into one field. */
offset = fold_convert (offset_type, offset);
- offset = fold_build2 (LSHIFT_EXPR, offset_type, offset,
+ offset = fold_build2_loc (input_location,
+ LSHIFT_EXPR, offset_type, offset,
build_int_cst (offset_type, 8));
- offset = fold_build2 (BIT_IOR_EXPR, offset_type, offset,
+ offset = fold_build2_loc (input_location,
+ BIT_IOR_EXPR, offset_type, offset,
build_int_cst (offset_type, flags));
base_init = tree_cons (NULL_TREE, offset, base_init);
base_init = tree_cons (NULL_TREE, tinfo, base_init);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 4473c4927b4..9ac88fd7b65 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3129,10 +3129,11 @@ simplify_aggr_init_expr (tree *tp)
style = arg;
}
- call_expr = build_call_array (TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
- fn,
- aggr_init_expr_nargs (aggr_init_expr),
- AGGR_INIT_EXPR_ARGP (aggr_init_expr));
+ call_expr = build_call_array_loc (input_location,
+ TREE_TYPE (TREE_TYPE (TREE_TYPE (fn))),
+ fn,
+ aggr_init_expr_nargs (aggr_init_expr),
+ AGGR_INIT_EXPR_ARGP (aggr_init_expr));
if (style == ctor)
{
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 255a297de6f..83869c17a1b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1595,7 +1595,8 @@ cxx_print_statistics (void)
tree
array_type_nelts_top (tree type)
{
- return fold_build2 (PLUS_EXPR, sizetype,
+ return fold_build2_loc (input_location,
+ PLUS_EXPR, sizetype,
array_type_nelts (type),
size_one_node);
}
@@ -1612,7 +1613,8 @@ array_type_nelts_total (tree type)
while (TREE_CODE (type) == ARRAY_TYPE)
{
tree n = array_type_nelts_top (type);
- sz = fold_build2 (MULT_EXPR, sizetype, sz, n);
+ sz = fold_build2_loc (input_location,
+ MULT_EXPR, sizetype, sz, n);
type = TREE_TYPE (type);
}
return sz;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 9e49ce58b4b..8b684dd795e 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2429,7 +2429,8 @@ build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
/*want_type=*/false);
member_type = cp_build_qualified_type (TREE_TYPE (member),
cp_type_quals (ptrmem_type));
- return fold_build3 (COMPONENT_REF, member_type,
+ return fold_build3_loc (input_location,
+ COMPONENT_REF, member_type,
ptrmem, member, NULL_TREE);
}
@@ -2836,7 +2837,8 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
TREE_NO_WARNING (vtbl) = 1;
/* Finally, extract the function pointer from the vtable. */
- e2 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtbl), vtbl,
+ e2 = fold_build2_loc (input_location,
+ POINTER_PLUS_EXPR, TREE_TYPE (vtbl), vtbl,
fold_convert (sizetype, idx));
e2 = cp_build_indirect_ref (e2, NULL, tf_warning_or_error);
TREE_CONSTANT (e2) = 1;
@@ -4095,7 +4097,7 @@ cp_pointer_int_sum (enum tree_code resultcode, tree ptrop, tree intop)
pointer_int_sum() anyway. */
complete_type (TREE_TYPE (res_type));
- return pointer_int_sum (resultcode, ptrop,
+ return pointer_int_sum (input_location, resultcode, ptrop,
fold_if_not_in_template (intop));
}
@@ -4393,7 +4395,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
case TRUTH_NOT_EXPR:
arg = perform_implicit_conversion (boolean_type_node, arg,
complain);
- val = invert_truthvalue (arg);
+ val = invert_truthvalue_loc (input_location, arg);
if (arg != error_mark_node)
return val;
errstring = "in argument to unary !";
@@ -5201,7 +5203,8 @@ convert_ptrmem (tree type, tree expr, bool allow_inverse_p,
PLUS_EXPR, op1, delta,
tf_warning_or_error);
- expr = fold_build3 (COND_EXPR, ptrdiff_type_node, cond, op1, op2);
+ expr = fold_build3_loc (input_location,
+ COND_EXPR, ptrdiff_type_node, cond, op1, op2);
}
@@ -6384,7 +6387,8 @@ get_delta_difference (tree from, tree to,
result = get_delta_difference_1 (to, from, c_cast_p);
if (result)
- result = size_diffop (size_zero_node, result);
+ result = size_diffop_loc (input_location,
+ size_zero_node, result);
else
{
error_not_base_type (from, to);