[RFA] Change enable_thread_stack_temporaries to an RAII class
Simon Marchi
simark@simark.ca
Fri Mar 9 03:58:00 GMT 2018
Oops, forgot this one:
On 2018-03-08 12:35 AM, Tom Tromey wrote:
> @@ -810,29 +771,26 @@ push_thread_stack_temporary (ptid_t ptid, struct value *v)
> struct thread_info *tp = find_thread_ptid (ptid);
>
> gdb_assert (tp != NULL && tp->stack_temporaries_enabled);
> - VEC_safe_push (value_ptr, tp->stack_temporaries, v);
> + tp->stack_temporaries.push_back (v);
> }
>
> -/* Return 1 if VAL is among the stack temporaries of the thread
> - with id PTID. Return 0 otherwise. */
> +/* Return true if VAL is among the stack temporaries of the thread
> + with id PTID. Return false otherwise. */
>
> -int
> +bool
> value_in_thread_stack_temporaries (struct value *val, ptid_t ptid)
> {
> struct thread_info *tp = find_thread_ptid (ptid);
>
> gdb_assert (tp != NULL && tp->stack_temporaries_enabled);
> - if (!VEC_empty (value_ptr, tp->stack_temporaries))
> + if (!tp->stack_temporaries.empty ())
> {
> - struct value *v;
> - int i;
> -
> - for (i = 0; VEC_iterate (value_ptr, tp->stack_temporaries, i, v); i++)
> + for (struct value *v : tp->stack_temporaries)
> if (v == val)
> - return 1;
> + return true;
The "if (!tp->stack_temporaries.empty ())" here is now unnecessary.
Simon
More information about the Gdb-patches
mailing list