Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

I ended up not adding another use of this, but it's still tidier.

gcc/cp/ChangeLog:

        * cp-gimplify.cc (struct cp_fold_data): Add mce().
        (cp_fold_r): Use it.
---
 gcc/cp/cp-gimplify.cc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index 9dec376bec4..a8c511b24a9 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -93,6 +93,10 @@ struct cp_fold_data
     gcc_checking_assert (!(flags & ff_mce_false)
                         || !(flags & ff_only_non_odr));
   }
+  mce_value mce ()
+  {
+    return flags & ff_mce_false ? mce_false : mce_unknown;
+  }
 };
 
 /* Forward declarations.  */
@@ -1740,9 +1744,7 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
        {
          tree to = TREE_OPERAND (*stmt_p, 0);
          tree &from = TREE_OPERAND (*stmt_p, 1);
-         tree folded = maybe_constant_init (from, to,
-                                            (data->flags & ff_mce_false
-                                             ? mce_false : mce_unknown));
+         tree folded = maybe_constant_init (from, to, data->mce ());
          if (folded != from && TREE_CONSTANT (folded))
            from = folded;
        }
@@ -1757,8 +1759,7 @@ cp_fold_r (tree *stmt_p, int *walk_subtrees, void *data_)
        if (tree &init = TARGET_EXPR_INITIAL (stmt))
          {
            tree folded = maybe_constant_init (init, TARGET_EXPR_SLOT (stmt),
-                                              (data->flags & ff_mce_false
-                                               ? mce_false : mce_unknown));
+                                              data->mce ());
            if (folded != init && TREE_CONSTANT (folded))
              init = folded;
          }

base-commit: e907bc4955ca7305fed4befff4c3d5f71d29d5e8
-- 
2.55.0

Reply via email to