From 6e1141d738f16417f55f88fdd087a50c71fdf1ae Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 7 May 2005 04:12:06 +0000 Subject: [PATCH] mangle.c (globals): Change the type of substitutions to VEC(tree,gc)*. * mangle.c (globals): Change the type of substitutions to VEC(tree,gc)*. (dump_substitution_candidates, add_substitution, find_substitution, finish_mangling, init_mangle): Use VEC instead of VARRAY. From-SVN: r99347 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/mangle.c | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5b229ef..faecf3f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -6,6 +6,12 @@ * name-lookup.h (cp_binding_level): Change the type of static_decls to VEC(tree,gc)*. + * mangle.c (globals): Change the type of substitutions to + VEC(tree,gc)*. + (dump_substitution_candidates, add_substitution, + find_substitution, finish_mangling, init_mangle): Use VEC + instead of VARRAY. + 2005-05-06 Kazu Hirata * decl2.c (spew_debug): Remove. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 2dd3e93..0d7f1e2 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -97,7 +97,7 @@ typedef struct globals GTY(()) { /* An array of the current substitution candidates, in the order we've seen them. */ - varray_type substitutions; + VEC(tree,gc) *substitutions; /* The entity that is being mangled. */ tree GTY ((skip)) entity; @@ -346,11 +346,11 @@ static void dump_substitution_candidates (void) { unsigned i; + tree el; fprintf (stderr, " ++ substitutions "); - for (i = 0; i < VARRAY_ACTIVE_SIZE (G.substitutions); ++i) + for (i = 0; VEC_iterate (tree, G.substitutions, i, el); ++i) { - tree el = VARRAY_TREE (G.substitutions, i); const char *name = "???"; if (i > 0) @@ -414,10 +414,10 @@ add_substitution (tree node) /* Make sure NODE isn't already a candidate. */ { int i; - for (i = VARRAY_ACTIVE_SIZE (G.substitutions); --i >= 0; ) + tree candidate; + + for (i = 0; VEC_iterate (tree, G.substitutions, i, candidate); i++) { - const tree candidate = VARRAY_TREE (G.substitutions, i); - gcc_assert (!(DECL_P (node) && node == candidate)); gcc_assert (!(TYPE_P (node) && TYPE_P (candidate) && same_type_p (node, candidate))); @@ -426,7 +426,7 @@ add_substitution (tree node) #endif /* ENABLE_CHECKING */ /* Put the decl onto the varray of substitution candidates. */ - VARRAY_PUSH_TREE (G.substitutions, node); + VEC_safe_push (tree, gc, G.substitutions, node); if (DEBUG_MANGLE) dump_substitution_candidates (); @@ -529,7 +529,7 @@ static int find_substitution (tree node) { int i; - const int size = VARRAY_ACTIVE_SIZE (G.substitutions); + const int size = VEC_length (tree, G.substitutions); tree decl; tree type; @@ -638,7 +638,7 @@ find_substitution (tree node) operation. */ for (i = 0; i < size; ++i) { - tree candidate = VARRAY_TREE (G.substitutions, i); + tree candidate = VEC_index (tree, G.substitutions, i); /* NODE is a matched to a candidate if it's the same decl node or if it's the same type. */ if (decl == candidate @@ -2505,7 +2505,7 @@ finish_mangling (const bool warn) G.entity); /* Clear all the substitutions. */ - VARRAY_CLEAR (G.substitutions); + VEC_truncate (tree, G.substitutions, 0); /* Null-terminate the string. */ write_char ('\0'); @@ -2520,7 +2520,7 @@ init_mangle (void) { gcc_obstack_init (&name_obstack); name_base = obstack_alloc (&name_obstack, 0); - VARRAY_TREE_INIT (G.substitutions, 1, "mangling substitutions"); + G.substitutions = NULL; /* Cache these identifiers for quick comparison when checking for standard substitutions. */ -- 2.7.4