Remove free_value_chain

This patch changes value_release_to_mark and fetch_subexp_value to
return a std::vector of value references, rather than relying on the
"next" field that is contained in a struct value.  This makes it
simpler to reason about the returned values, and also allows for the
removal of free_value_chain.

gdb/ChangeLog
2018-04-06  Tom Tromey  <tom@tromey.com>

	* value.h (fetch_subexp_value, value_release_to_mark): Update.
	(free_value_chain): Remove.
	* value.c (free_value_chain): Remove.
	(value_release_to_mark): Return a std::vector.
	* ppc-linux-nat.c (num_memory_accesses): Change "chain" to a
	std::vector.
	(check_condition): Update.
	* eval.c (fetch_subexp_value): Change "val_chain" to a
	std::vector.
	* breakpoint.c (update_watchpoint): Update.
	(can_use_hardware_watchpoint): Change "vals" to a std::vector.
This commit is contained in:
Tom Tromey
2018-04-03 20:20:01 -06:00
parent b562120198
commit a6535de190
6 changed files with 69 additions and 73 deletions

View File

@ -915,7 +915,7 @@ extern value *eval_skip_value (expression *exp);
extern void fetch_subexp_value (struct expression *exp, int *pc,
struct value **valp, struct value **resultp,
struct value **val_chain,
std::vector<value_ref_ptr> *val_chain,
int preserve_errors);
extern const char *extract_field_op (struct expression *exp, int *subexp);
@ -1053,8 +1053,6 @@ extern int unop_user_defined_p (enum exp_opcode op, struct value *arg1);
extern int destructor_name_p (const char *name, struct type *type);
extern void free_value_chain (struct value *v);
extern value_ref_ptr release_value (struct value *val);
extern int record_latest_value (struct value *val);
@ -1084,7 +1082,14 @@ extern void value_print_array_elements (struct value *val,
struct ui_file *stream, int format,
enum val_prettyformat pretty);
extern struct value *value_release_to_mark (const struct value *mark);
/* Release values from the value chain and return them. Values
created after MARK are released. If MARK is nullptr, or if MARK is
not found on the value chain, then all values are released. Values
are returned in reverse order of creation; that is, newest
first. */
extern std::vector<value_ref_ptr> value_release_to_mark
(const struct value *mark);
extern void val_print (struct type *type,
LONGEST embedded_offset, CORE_ADDR address,