[v2,45/48] Make ~value private

Message ID 20230209-submit-value-fixups-2023-v2-45-b0b27fd97177@tromey.com
State New
Headers
Series Use methods for struct value |

Commit Message

Tom Tromey Feb. 10, 2023, 9:53 p.m. UTC
  At the end of this series, I belatedly realized that values should
only be destroyed by value_decref.  This patch marks the the
destructor private to enforce this.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
---
 gdb/value.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Patch

diff --git a/gdb/value.h b/gdb/value.h
index cef027d9c4c..a78c8c22937 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -142,6 +142,12 @@  struct value
   {
   }
 
+  /* Values can only be destroyed via the reference-counting
+     mechanism.  */
+  ~value ();
+
+  DISABLE_COPY_AND_ASSIGN (value);
+
 public:
 
   /* Allocate a lazy value for type TYPE.  Its actual content is
@@ -169,10 +175,6 @@  struct value
      but it's a different block of storage.  */
   struct value *copy () const;
 
-  ~value ();
-
-  DISABLE_COPY_AND_ASSIGN (value);
-
   /* Type of the value.  */
   struct type *type () const
   { return m_type; }