aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-gimplify.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-10-26 14:10:53 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-10-26 14:10:53 -0400
commit534ecb17516c5db7a96245ebb90beb206e22eaff (patch)
tree0f1b677728d44296d9537a0c12aa3f3f1615257d /gcc/cp/cp-gimplify.c
parent73c982bc87c8eb33a37ba3242f8d82bc512e4189 (diff)
downloadgcc-534ecb17516c5db7a96245ebb90beb206e22eaff.zip
gcc-534ecb17516c5db7a96245ebb90beb206e22eaff.tar.gz
gcc-534ecb17516c5db7a96245ebb90beb206e22eaff.tar.bz2
tree.c (build_vec_init_expr): Split out from...
* tree.c (build_vec_init_expr): Split out from... (build_array_copy): ...here. * init.c (perform_member_init): Use it. * cp-tree.h: Declare it. * cp-gimplify.c (cp_gimplify_init_expr): Don't gimplify the slot for VEC_INIT_EXPR and AGGR_INIT_EXPR here. Drop pre/post parameters. (cp_gimplify_expr): Handle array default-initialization via VEC_INIT_EXPR. From-SVN: r165976
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r--gcc/cp/cp-gimplify.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index e5a7f26..dd879c6 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -424,7 +424,7 @@ gimplify_expr_stmt (tree *stmt_p)
/* Gimplify initialization from an AGGR_INIT_EXPR. */
static void
-cp_gimplify_init_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
+cp_gimplify_init_expr (tree *expr_p)
{
tree from = TREE_OPERAND (*expr_p, 1);
tree to = TREE_OPERAND (*expr_p, 0);
@@ -451,7 +451,6 @@ cp_gimplify_init_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
if (TREE_CODE (sub) == AGGR_INIT_EXPR
|| TREE_CODE (sub) == VEC_INIT_EXPR)
{
- gimplify_expr (&to, pre_p, post_p, is_gimple_lvalue, fb_lvalue);
if (TREE_CODE (sub) == AGGR_INIT_EXPR)
AGGR_INIT_EXPR_SLOT (sub) = to;
else
@@ -531,10 +530,13 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
case VEC_INIT_EXPR:
{
location_t loc = input_location;
+ tree init = VEC_INIT_EXPR_INIT (*expr_p);
+ int from_array = (init && TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE);
gcc_assert (EXPR_HAS_LOCATION (*expr_p));
input_location = EXPR_LOCATION (*expr_p);
*expr_p = build_vec_init (VEC_INIT_EXPR_SLOT (*expr_p), NULL_TREE,
- VEC_INIT_EXPR_INIT (*expr_p), false, 1,
+ init, /*explicit_value_init_p*/false,
+ from_array,
tf_warning_or_error);
ret = GS_OK;
input_location = loc;
@@ -556,7 +558,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
LHS of an assignment might also be involved in the RHS, as in bug
25979. */
case INIT_EXPR:
- cp_gimplify_init_expr (expr_p, pre_p, post_p);
+ cp_gimplify_init_expr (expr_p);
if (TREE_CODE (*expr_p) != INIT_EXPR)
return GS_OK;
/* Otherwise fall through. */