Basic c++ification of varobj
This patch does a basic c++ification or the varobj data structure.
- varobj: add constructor and destructor, initialize fields
- varobj_root: initialize fields
- varobj_dynamic: initialize fields
This allows getting rid of new_variable, new_root_variable.
free_variable essentially becomes varobj's destructor. This also allows
getting rid of a cleanup, make_cleanup_free_variable, which was only
used in varobj_create in case the varobj creation fails. It is replaced
with a unique_ptr.
gdb/ChangeLog:
* varobj.h (struct varobj): Add constructor and destructor,
initialize fields.
* varobj.c (struct varobj_root): Initialize fields.
(struct varobj_dynamic): Initialize fields.
(varobj_create): Use unique_ptr instead of cleanup. Create
varobj with new instead of new_root_variable.
(delete_variable_1): Free variable with delete instead of
free_variable.
(create_child_with_value): Create variable with new instead of
new_variable.
(varobj::varobj): New.
(varobj::~varobj): New (body mostly coming from free_variable).
(new_variable): Remove.
(free_variable): Remove.
(do_free_variable_cleanup): Remove.
(make_cleanup_free_variable): Remove.