From 60ee72f6d3bf10b4bd3ef1315c72c4551c459224 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tom@tromey.com>
Date: Fri, 11 Dec 2020 09:33:36 -0700
Subject: Change varobj_iter::next to return unique_ptr

This changes varobj_iter::next to return a unique_ptr.  This fits in
with the ongoing theme of trying to express these ownership transfers
via the type system.

gdb/ChangeLog
2020-12-11  Tom Tromey  <tom@tromey.com>

	* varobj.c (update_dynamic_varobj_children): Update.
	* varobj-iter.h (struct varobj_iter) <next>: Change return type.
	* python/py-varobj.c (struct py_varobj_iter) <next>: Change return
	type.
	(py_varobj_iter::next): Likewise.
---
 gdb/python/py-varobj.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'gdb/python/py-varobj.c')

diff --git a/gdb/python/py-varobj.c b/gdb/python/py-varobj.c
index df6f9c5..c3fb2e9 100644
--- a/gdb/python/py-varobj.c
+++ b/gdb/python/py-varobj.c
@@ -26,7 +26,7 @@ struct py_varobj_iter : public varobj_iter
   py_varobj_iter (struct varobj *var, gdbpy_ref<> &&pyiter);
   ~py_varobj_iter () override;
 
-  varobj_item *next () override;
+  std::unique_ptr<varobj_item> next () override;
 
 private:
 
@@ -55,7 +55,7 @@ py_varobj_iter::~py_varobj_iter ()
 /* Implementation of the 'next' method of pretty-printed varobj
    iterators.  */
 
-varobj_item *
+std::unique_ptr<varobj_item>
 py_varobj_iter::next ()
 {
   PyObject *py_v;
@@ -117,7 +117,7 @@ py_varobj_iter::next ()
   vitem->name = name;
 
   m_next_raw_index++;
-  return vitem;
+  return std::unique_ptr<varobj_item> (vitem);
 }
 
 /* Constructor of pretty-printed varobj iterators.  VAR is the varobj
-- 
cgit v1.1