[v2,2/3] gdb: add constructor to internalvar
Commit Message
Add a constructor that takes the name as a parameter. Initialize the
Change-Id: Ic4db0aba85f1da9f12f3eee0ac62c0e5ef0cfe88
---
gdb/value.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Comments
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> Add a constructor that takes the name as a parameter. Initialize the
This is truncated.
Tom
On 2/14/23 15:42, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> Add a constructor that takes the name as a parameter. Initialize the
>
> This is truncated.
Woops, it should have read:
gdb: add constructor to internalvar
Add a constructor that takes the name as a parameter. Initialize the
next and kind fields inline.
Simon
>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
Simon> On 2/14/23 15:42, Tom Tromey wrote:
>>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>>
Simon> Add a constructor that takes the name as a parameter. Initialize the
>>
>> This is truncated.
Simon> Woops, it should have read:
Simon> gdb: add constructor to internalvar
Simon> Add a constructor that takes the name as a parameter. Initialize the
Simon> next and kind fields inline.
Thanks, this is fine by me.
Tom
On 2/15/23 11:56, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Simon> On 2/14/23 15:42, Tom Tromey wrote:
>>>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>>>
> Simon> Add a constructor that takes the name as a parameter. Initialize the
>>>
>>> This is truncated.
>
> Simon> Woops, it should have read:
>
> Simon> gdb: add constructor to internalvar
>
> Simon> Add a constructor that takes the name as a parameter. Initialize the
> Simon> next and kind fields inline.
>
> Thanks, this is fine by me.
>
> Tom
Thanks, I will push the series now.
Simon
@@ -1829,14 +1829,18 @@ union internalvar_data
struct internalvar
{
- struct internalvar *next;
+ internalvar (std::string name)
+ : name (std::move (name))
+ {}
+
+ struct internalvar *next = nullptr;
std::string name;
/* We support various different kinds of content of an internal variable.
enum internalvar_kind specifies the kind, and union internalvar_data
provides the data associated with this particular kind. */
- enum internalvar_kind kind;
+ enum internalvar_kind kind = INTERNALVAR_VOID;
union internalvar_data u;
};
@@ -1922,10 +1926,8 @@ complete_internalvar (completion_tracker &tracker, const char *name)
struct internalvar *
create_internalvar (const char *name)
{
- internalvar *var = new internalvar;
+ internalvar *var = new internalvar (name);
- var->name = name;
- var->kind = INTERNALVAR_VOID;
var->next = internalvars;
internalvars = var;
return var;