+2019-03-23 Tom Tromey <tom@tromey.com>
+
+ * linespec.c (get_current_search_block): Use
+ scoped_restore_current_language.
+ * symmisc.c (dump_symtab): Use scoped_restore_current_language.
+
2019-03-22 Alan Hayward <alan.hayward@arm.com>
Jiong Wang <jiong.wang@arm.com>
static const struct block *
get_current_search_block (void)
{
- const struct block *block;
- enum language save_language;
-
/* get_selected_block can change the current language when there is
no selected frame yet. */
- save_language = current_language->la_language;
- block = get_selected_block (0);
- set_language (save_language);
-
- return block;
+ scoped_restore_current_language save_language;
+ return get_selected_block (0);
}
/* Iterate over static and global blocks. */
if (symtab->language != language_unknown
&& symtab->language != language_auto)
{
- enum language saved_lang;
-
- saved_lang = set_language (symtab->language);
-
+ scoped_restore_current_language save_lang;
+ set_language (symtab->language);
dump_symtab_1 (symtab, outfile);
-
- set_language (saved_lang);
}
else
dump_symtab_1 (symtab, outfile);