This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA v2 10/24] Remove make_cleanup_restore_current_language
>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>> + explicit scoped_restore_language (enum language new_lang)
>> + : m_lang (current_language->la_language)
>> + {
>> + set_language (new_lang);
>> + }
Simon> To follow the nomenclature and behavior of other scoped_restore_*
Simon> , I think this:
Simon> 1. should be named scoped_restore_current_language
Ok.
Simon> 2. should only only save and restore the current language, and
Simon> not set the new language.
scoped_restore allows setting the new value. That's what I was copying
here. From scoped_restore.h:
/* Create a new scoped_restore object that saves the current value
of *VAR, and sets *VAR to VALUE. *VAR will be restored when this
scoped_restore object is destroyed. This is templated on T2 to
allow passing VALUEs of types convertible to T.
E.g.: T='base'; T2='derived'. */
template <typename T2>
scoped_restore_tmpl (T *var, T2 value)
: scoped_restore_base (var),
m_saved_value (*var)
{
*var = value;
}
Tom