]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/cp/cp-gimplify.c
This patch rewrites the old VEC macro-based interface into a new one
[thirdparty/gcc.git] / gcc / cp / cp-gimplify.c
index f715e963c490d665e4c9a5829e8fa74f15653a8f..cde480d3548115a08ca0de3d774c16c45ed943f4 100644 (file)
@@ -824,7 +824,7 @@ omp_cxx_notice_variable (struct cp_genericize_omp_taskreg *omp_ctx, tree decl)
 struct cp_genericize_data
 {
   struct pointer_set_t *p_set;
-  VEC (tree, heap) *bind_expr_stack;
+  vec<tree> bind_expr_stack;
   struct cp_genericize_omp_taskreg *omp_ctx;
 };
 
@@ -1015,10 +1015,10 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
                                     : OMP_CLAUSE_DEFAULT_PRIVATE);
              }
        }
-      VEC_safe_push (tree, heap, wtd->bind_expr_stack, stmt);
+      wtd->bind_expr_stack.safe_push (stmt);
       cp_walk_tree (&BIND_EXPR_BODY (stmt),
                    cp_genericize_r, data, NULL);
-      VEC_pop (tree, wtd->bind_expr_stack);
+      wtd->bind_expr_stack.pop ();
     }
 
   else if (TREE_CODE (stmt) == USING_STMT)
@@ -1028,12 +1028,11 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
       /* Get the innermost inclosing GIMPLE_BIND that has a non NULL
          BLOCK, and append an IMPORTED_DECL to its
         BLOCK_VARS chained list.  */
-      if (wtd->bind_expr_stack)
+      if (wtd->bind_expr_stack.exists ())
        {
          int i;
-         for (i = VEC_length (tree, wtd->bind_expr_stack) - 1; i >= 0; i--)
-           if ((block = BIND_EXPR_BLOCK (VEC_index (tree,
-                                                    wtd->bind_expr_stack, i))))
+         for (i = wtd->bind_expr_stack.length () - 1; i >= 0; i--)
+           if ((block = BIND_EXPR_BLOCK (wtd->bind_expr_stack[i])))
              break;
        }
       if (block)
@@ -1151,11 +1150,11 @@ cp_genericize_tree (tree* t_p)
   struct cp_genericize_data wtd;
 
   wtd.p_set = pointer_set_create ();
-  wtd.bind_expr_stack = NULL;
+  wtd.bind_expr_stack.create (0);
   wtd.omp_ctx = NULL;
   cp_walk_tree (t_p, cp_genericize_r, &wtd, NULL);
   pointer_set_destroy (wtd.p_set);
-  VEC_free (tree, heap, wtd.bind_expr_stack);
+  wtd.bind_expr_stack.release ();
 }
 
 void