[PATCH 6/7] jit: c++-ify gdb_block
Simon Marchi
simon.marchi@polymtl.ca
Fri Dec 13 21:02:00 GMT 2019
On 2019-12-13 3:57 p.m., Pedro Alves wrote:
> On 12/13/19 3:18 PM, Simon Marchi wrote:
>> On 2019-12-13 10:10 a.m., Christian Biesinger via gdb-patches wrote:
>>>> @@ -455,10 +463,7 @@ struct gdb_symtab
>>>> ~gdb_symtab ()
>>>> {
>>>> for (gdb_block *gdb_block_iter : this->blocks)
>>>> - {
>>>> - xfree ((void *) gdb_block_iter->name);
>>>> - xfree (gdb_block_iter);
>>>> - }
>>>> + delete gdb_block_iter;
>>>> }
>>>>
>>>
>>> Have you considered making this a vector of unique_ptrs, so you don't have
>>> to manually delete them?
>>
>> Yes, it's done in the following patch. I went perhaps a bit overboard with the
>> patch splitting, but I prefer to do these changes in many smaller patches, so that
>> if something goes wrong, it's easier to identify the culprit.
>
> I wonder whether it wouldn't be simpler to use std::list<object> for these cases.
I don't think the code would be much different if use used a list, so I don't expect it
to be much simpler. If there's a compelling argument for using a list, I can do the
change, but if it's equivalent, I'd rather stick with what is already done.
Simon
More information about the Gdb-patches
mailing list