aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-gimplify.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-12-20 18:31:05 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-12-20 18:31:05 +0100
commit50867d20f4356714df1392a35240db8712c878f4 (patch)
tree57a59d9550395c76e35e6a4d6133c5f8ab8c0f5f /gcc/cp/cp-gimplify.c
parent69c5fdcf6eaee5e20073aa76152ef7b402619998 (diff)
downloadgcc-50867d20f4356714df1392a35240db8712c878f4.zip
gcc-50867d20f4356714df1392a35240db8712c878f4.tar.gz
gcc-50867d20f4356714df1392a35240db8712c878f4.tar.bz2
cp-tree.h (cp_fully_fold_init): Declare.
* cp-tree.h (cp_fully_fold_init): Declare. * cp-gimplify.c (cp_fully_fold_init): New function. * typeck2.c (split_nonconstant_init, store_init_value): Use it instead of cp_fully_fold. From-SVN: r267305
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r--gcc/cp/cp-gimplify.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index d27e39c..9d848ea 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -2171,6 +2171,20 @@ cp_fully_fold (tree x)
return cp_fold_rvalue (x);
}
+/* Likewise, but also fold recursively, which cp_fully_fold doesn't perform
+ in some cases. */
+
+tree
+cp_fully_fold_init (tree x)
+{
+ if (processing_template_decl)
+ return x;
+ x = cp_fully_fold (x);
+ hash_set<tree> pset;
+ cp_walk_tree (&x, cp_fold_r, &pset, NULL);
+ return x;
+}
+
/* c-common interface to cp_fold. If IN_INIT, this is in a static initializer
and certain changes are made to the folding done. Or should be (FIXME). We
never touch maybe_const, as it is only used for the C front-end