aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile/compile-loc2c.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-07 16:05:42 -0600
committerTom Tromey <tom@tromey.com>2017-04-12 11:16:19 -0600
commit711799d513206f6d8fc3dbfa81dcdecdb2ce6ece (patch)
tree9f44163de9be091517f132a0f53876c3648553da /gdb/compile/compile-loc2c.c
parent52d214d3e1b2f6a1382feafbf2984acdb24c0c95 (diff)
downloadgdb-711799d513206f6d8fc3dbfa81dcdecdb2ce6ece.zip
gdb-711799d513206f6d8fc3dbfa81dcdecdb2ce6ece.tar.gz
gdb-711799d513206f6d8fc3dbfa81dcdecdb2ce6ece.tar.bz2
Use std::vector in compile-loc2c.c
This changes compile-loc2c.c to use std::vector in place of a VEC, allowing the removal of a cleanup. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * compile/compile-loc2c.c (compute_stack_depth_worker): Change type of "to_do". Update. (compute_stack_depth): Use std::vector.
Diffstat (limited to 'gdb/compile/compile-loc2c.c')
-rw-r--r--gdb/compile/compile-loc2c.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index f1296e8..a53214f 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -72,7 +72,7 @@ struct insn_info
static void
compute_stack_depth_worker (int start, int *need_tempvar,
struct insn_info *info,
- VEC (int) **to_do,
+ std::vector<int> *to_do,
enum bfd_endian byte_order, unsigned int addr_size,
const gdb_byte *op_ptr, const gdb_byte *op_end)
{
@@ -334,7 +334,7 @@ compute_stack_depth_worker (int start, int *need_tempvar,
/* If the destination has not been seen yet, add it to the
to-do list. */
if (!info[offset].visited)
- VEC_safe_push (int, *to_do, offset);
+ to_do->push_back (offset);
SET_CHECK_DEPTH (offset);
info[offset].label = 1;
/* We're done with this line of code. */
@@ -348,7 +348,7 @@ compute_stack_depth_worker (int start, int *need_tempvar,
/* If the destination has not been seen yet, add it to the
to-do list. */
if (!info[offset].visited)
- VEC_safe_push (int, *to_do, offset);
+ to_do->push_back (offset);
SET_CHECK_DEPTH (offset);
info[offset].label = 1;
break;
@@ -390,22 +390,21 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
struct insn_info **info)
{
unsigned char *set;
- struct cleanup *outer_cleanup, *cleanup;
- VEC (int) *to_do = NULL;
+ struct cleanup *outer_cleanup;
+ std::vector<int> to_do;
int stack_depth, i;
*info = XCNEWVEC (struct insn_info, op_end - op_ptr);
outer_cleanup = make_cleanup (xfree, *info);
- cleanup = make_cleanup (VEC_cleanup (int), &to_do);
-
- VEC_safe_push (int, to_do, 0);
+ to_do.push_back (0);
(*info)[0].depth = initial_depth;
(*info)[0].visited = 1;
- while (!VEC_empty (int, to_do))
+ while (!to_do.empty ())
{
- int ndx = VEC_pop (int, to_do);
+ int ndx = to_do.back ();
+ to_do.pop_back ();
compute_stack_depth_worker (ndx, need_tempvar, *info, &to_do,
byte_order, addr_size,
@@ -422,7 +421,6 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
*is_tls = 1;
}
- do_cleanups (cleanup);
discard_cleanups (outer_cleanup);
return stack_depth + 1;
}