aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.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/rtti.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/rtti.c')
-rw-r--r--gcc/cp/rtti.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 10ecbfd..b158507 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -206,8 +206,7 @@ build_headof (tree exp)
index = build_int_cst (NULL_TREE,
-2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
- offset = build_vtbl_ref (cp_build_indirect_ref (exp, RO_NULL,
- tf_warning_or_error),
+ offset = build_vtbl_ref (cp_build_fold_indirect_ref (exp),
index);
type = cp_build_qualified_type (ptr_type_node,
@@ -303,7 +302,7 @@ get_tinfo_decl_dynamic (tree exp, tsubst_flags_t complain)
/* Otherwise return the type_info for the static type of the expr. */
t = get_tinfo_ptr (TYPE_MAIN_VARIANT (type));
- return cp_build_indirect_ref (t, RO_NULL, complain);
+ return cp_build_fold_indirect_ref (t);
}
static bool
@@ -365,7 +364,7 @@ build_typeid (tree exp, tsubst_flags_t complain)
exp = cp_build_addr_expr (exp, complain);
exp = save_expr (exp);
cond = cp_convert (boolean_type_node, exp, complain);
- exp = cp_build_indirect_ref (exp, RO_NULL, complain);
+ exp = cp_build_fold_indirect_ref (exp);
}
exp = get_tinfo_decl_dynamic (exp, complain);
@@ -529,7 +528,7 @@ get_typeid (tree type, tsubst_flags_t complain)
if (!type)
return error_mark_node;
- return cp_build_indirect_ref (get_tinfo_ptr (type), RO_NULL, complain);
+ return cp_build_fold_indirect_ref (get_tinfo_ptr (type));
}
/* Check whether TEST is null before returning RESULT. If TEST is used in