aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-31 14:25:29 -0700
committerTom Tromey <tom@tromey.com>2023-02-13 15:22:16 -0700
commitcdf3de175d41acec85d6c3cc8b599f79658edb06 (patch)
tree7f88b2ac4f2fb3ca547575063bae003ade56abab /gdb/value.h
parentd3824ae14ac64c10733537969a0bd58a9385cbf2 (diff)
downloadgdb-cdf3de175d41acec85d6c3cc8b599f79658edb06.zip
gdb-cdf3de175d41acec85d6c3cc8b599f79658edb06.tar.gz
gdb-cdf3de175d41acec85d6c3cc8b599f79658edb06.tar.bz2
Turn value_incref and value_decref into methods
This changes value_incref and value_decref to be methods of value. Much of this patch was written by script. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/value.h')
-rw-r--r--gdb/value.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/gdb/value.h b/gdb/value.h
index b18eace..0abe0a4 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -111,15 +111,6 @@ struct range
}
};
-/* Increase VAL's reference count. */
-
-extern void value_incref (struct value *val);
-
-/* Decrease VAL's reference count. When the reference count drops to
- 0, VAL will be freed. */
-
-extern void value_decref (struct value *val);
-
/* A policy class to interface gdb::ref_ptr with struct value. */
struct value_ref_policy
@@ -453,6 +444,14 @@ public:
int bits_synthetic_pointer (LONGEST offset, LONGEST length) const;
+ /* Increase this value's reference count. */
+ void incref ()
+ { ++m_reference_count; }
+
+ /* Decrease this value's reference count. When the reference count
+ drops to 0, it will be freed. */
+ void decref ();
+
/* Type of value; either not an lval, or one of the various
different possible kinds of lval. */
@@ -673,13 +672,13 @@ private:
inline void
value_ref_policy::incref (struct value *ptr)
{
- value_incref (ptr);
+ ptr->incref ();
}
inline void
value_ref_policy::decref (struct value *ptr)
{
- value_decref (ptr);
+ ptr->decref ();
}
/* Returns value_type or value_enclosing_type depending on