aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-10-08 12:20:49 -0600
committerTom Tromey <tom@tromey.com>2017-10-08 23:07:37 -0600
commit757325a3f24e01bf8e7b7214f33c546bc52d1d12 (patch)
treedcc5507c805dd3805e066c269d4154b50f3e0f19 /gdb/value.h
parentChange search_symbols to return std::vector (diff)
downloadbinutils-gdb-757325a3f24e01bf8e7b7214f33c546bc52d1d12.tar.gz
binutils-gdb-757325a3f24e01bf8e7b7214f33c546bc52d1d12.tar.bz2
binutils-gdb-757325a3f24e01bf8e7b7214f33c546bc52d1d12.zip
Remove make_cleanup_value_free
This removes make_cleanup_value_free, in favor of a unique_ptr specialization. Regression tested by the buildbot. gdb/ChangeLog 2017-10-08 Tom Tromey <tom@tromey.com> * utils.h (make_cleanup_value_free): Remove. * utils.c (do_value_free, struct cleanup): Remove. * dwarf2loc.c (dwarf2_evaluate_loc_desc_full) <DWARF_VALUE_STACK>: Use gdb_value_up. * value.h (struct value_deleter): New. (gdb_value_up): New typedef.
Diffstat (limited to 'gdb/value.h')
-rw-r--r--gdb/value.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/value.h b/gdb/value.h
index 6dee80af339..bc97ec0728f 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1018,6 +1018,21 @@ extern void value_incref (struct value *val);
extern void value_free (struct value *val);
+/* A free policy class to interface std::unique_ptr with
+ value_free. */
+
+struct value_deleter
+{
+ void operator() (struct value *value) const
+ {
+ value_free (value);
+ }
+};
+
+/* A unique pointer to a struct value. */
+
+typedef std::unique_ptr<struct value, value_deleter> gdb_value_up;
+
extern void free_all_values (void);
extern void free_value_chain (struct value *v);