mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-23 10:17:53 +08:00
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.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user