Re: [PATCH] Change management of tdesc_arch_data

Tom Tromey
2020-09-17T20:26:13Z

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> @@ -784,10 +784,8 @@ tdesc_data_alloc (void)
>> architecture). */
>>
>> void
>> -tdesc_data_cleanup (void *data_untyped)
>> +tdesc_arch_data_deleter::operator() (struct tdesc_arch_data *data) const

Simon> I think the comment above this is not relevant, and should be made into the
Simon> usual /* See foo.h. */.

I made this change.

>> data-> arch_regs = early_data->arch_regs;

Simon> Not really important, but this could be an std::move to avoid
Simon> copying the vector.

And this one.

>> + tdesc_arch_data_up tdesc_data;

Simon> Move this where this is used, in the if? That will avoid
Simon> unnecessary construction/destruction.

It's used near the end of the function:

if (tdesc_data != nullptr)
tdesc_use_registers (gdbarch, tdesc, std::move (tdesc_data));

This pattern is typical, so I didn't change anything here.

I'm going to check this patch in shortly.

Tom