From cdf3de175d41acec85d6c3cc8b599f79658edb06 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 31 Jan 2023 14:25:29 -0700 Subject: 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 --- gdb/value.h | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'gdb/value.h') 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 -- cgit v1.1