aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/value.h')
-rw-r--r--gdb/value.h52
1 files changed, 30 insertions, 22 deletions
diff --git a/gdb/value.h b/gdb/value.h
index 0bc5130..f7e7387 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -22,6 +22,7 @@
#include "frame.h" /* For struct frame_id. */
#include "extension.h"
+#include "common/gdb_ref_ptr.h"
struct block;
struct expression;
@@ -87,6 +88,34 @@ struct value_print_options;
struct value;
+/* Decrease VAL's reference count. When the reference count drops to
+ 0, VAL will be freed. */
+
+extern struct value *value_incref (struct value *val);
+
+/* Increate VAL's reference count. VAL is returned. */
+
+extern void value_decref (struct value *val);
+
+/* A policy class to interface gdb::ref_ptr with struct value. */
+
+struct value_ref_policy
+{
+ static void incref (struct value *ptr)
+ {
+ value_incref (ptr);
+ }
+
+ static void decref (struct value *ptr)
+ {
+ value_decref (ptr);
+ }
+};
+
+/* A gdb:;ref_ptr pointer to a struct value. */
+
+typedef gdb::ref_ptr<struct value, value_ref_policy> value_ref_ptr;
+
/* Values are stored in a chain, so that they can be deleted easily
over calls to the inferior. Values assigned to internal variables,
put into the value history or exposed to Python are taken off this
@@ -1024,32 +1053,11 @@ 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 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);
-extern void release_value (struct value *val);
-
-extern void release_value_or_incref (struct value *val);
+extern value_ref_ptr release_value (struct value *val);
extern int record_latest_value (struct value *val);