aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-11-13 17:12:55 -0500
committerJason Merrill <jason@gcc.gnu.org>2017-11-13 17:12:55 -0500
commit04757a2a49bd21c71af386a64591f77c165a0d93 (patch)
tree1abdf8c3ce6efdfe6e521741c681eae3a746db70 /gcc/cp/class.c
parentcd920e1348eaa1100b90f378f44e110152816149 (diff)
downloadgcc-04757a2a49bd21c71af386a64591f77c165a0d93.zip
gcc-04757a2a49bd21c71af386a64591f77c165a0d93.tar.gz
gcc-04757a2a49bd21c71af386a64591f77c165a0d93.tar.bz2
Defer folding of *&.
* typeck.c (cp_build_fold_indirect_ref): New. (cp_build_indirect_ref_1): Split out from cp_build_indirect_ref. Add 'fold' parameter. * cp-tree.h: Declare cp_build_fold_indirect_ref. * call.c, class.c, cp-ubsan.c, decl.c, except.c, init.c, lambda.c, parser.c, rtti.c, tree.c, typeck.c, typeck2.c: Use it. * parser.c (do_range_for_auto_deduction): Use RO_UNARY_STAR. (cp_convert_range_for): Likewise. * typeck2.c (build_x_arrow): Use RO_ARROW. From-SVN: r254712
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 98e62c6..586a32c 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -425,7 +425,7 @@ build_base_path (enum tree_code code,
interesting to the optimizers anyway. */
&& !has_empty)
{
- expr = cp_build_indirect_ref (expr, RO_NULL, complain);
+ expr = cp_build_fold_indirect_ref (expr);
expr = build_simple_base_path (expr, binfo);
if (rvalue)
expr = move (expr);
@@ -452,7 +452,7 @@ build_base_path (enum tree_code code,
t = TREE_TYPE (TYPE_VFIELD (current_class_type));
t = build_pointer_type (t);
v_offset = fold_convert (t, current_vtt_parm);
- v_offset = cp_build_indirect_ref (v_offset, RO_NULL, complain);
+ v_offset = cp_build_fold_indirect_ref (v_offset);
}
else
{
@@ -465,8 +465,7 @@ build_base_path (enum tree_code code,
if (t == NULL_TREE)
t = expr;
}
- v_offset = build_vfield_ref (cp_build_indirect_ref (t, RO_NULL,
- complain),
+ v_offset = build_vfield_ref (cp_build_fold_indirect_ref (t),
TREE_TYPE (TREE_TYPE (expr)));
}
@@ -477,7 +476,7 @@ build_base_path (enum tree_code code,
v_offset = build1 (NOP_EXPR,
build_pointer_type (ptrdiff_type_node),
v_offset);
- v_offset = cp_build_indirect_ref (v_offset, RO_NULL, complain);
+ v_offset = cp_build_fold_indirect_ref (v_offset);
TREE_CONSTANT (v_offset) = 1;
offset = convert_to_integer (ptrdiff_type_node,
@@ -516,7 +515,7 @@ build_base_path (enum tree_code code,
indout:
if (!want_pointer)
{
- expr = cp_build_indirect_ref (expr, RO_NULL, complain);
+ expr = cp_build_fold_indirect_ref (expr);
if (rvalue)
expr = move (expr);
}
@@ -552,7 +551,7 @@ build_simple_base_path (tree expr, tree binfo)
in the back end. */
temp = unary_complex_lvalue (ADDR_EXPR, expr);
if (temp)
- expr = cp_build_indirect_ref (temp, RO_NULL, tf_warning_or_error);
+ expr = cp_build_fold_indirect_ref (temp);
return expr;
}
@@ -745,8 +744,7 @@ build_vfn_ref (tree instance_ptr, tree idx)
{
tree aref;
- aref = build_vtbl_ref_1 (cp_build_indirect_ref (instance_ptr, RO_NULL,
- tf_warning_or_error),
+ aref = build_vtbl_ref_1 (cp_build_fold_indirect_ref (instance_ptr),
idx);
/* When using function descriptors, the address of the