summaryrefslogtreecommitdiff
path: root/gdb/cp-support.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-01 08:32:13 -0600
committerTom Tromey <tom@tromey.com>2017-11-04 10:27:16 -0600
commit167b0be1b5ef36a5605fcdfba0c84db2ed475e1e (patch)
tree87acaf68f4d6149dcfc8640819ffe1f65d52925b /gdb/cp-support.c
parent5eae7aeaf754549d3645a0c590c5ef9f0134a32d (diff)
downloadbinutils-gdb-167b0be1b5ef36a5605fcdfba0c84db2ed475e1e.tar.gz
Remove directive-searched cleanups
This removes a few cleanups related to the "searched" field in struct using_direct, replacing these with scoped_restore. gdb/ChangeLog 2017-11-04 Tom Tromey <tom@tromey.com> * cp-namespace.c (reset_directive_searched): Remove. (cp_lookup_symbol_via_imports): Use scoped_restore. * cp-support.c (reset_directive_searched): Remove. (make_symbol_overload_list_using): Use scoped_restore. * d-namespace.c (d_lookup_symbol_imports): Use scoped_restore. (reset_directive_searched): Remove.
Diffstat (limited to 'gdb/cp-support.c')
-rw-r--r--gdb/cp-support.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index 37b2b4af970..817de59f12f 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -1286,16 +1286,6 @@ make_symbol_overload_list_adl (struct type **arg_types, int nargs,
return sym_return_val;
}
-/* Used for cleanups to reset the "searched" flag in case of an
- error. */
-
-static void
-reset_directive_searched (void *data)
-{
- struct using_direct *direct = (struct using_direct *) data;
- direct->searched = 0;
-}
-
/* This applies the using directives to add namespaces to search in,
and then searches for overloads in all of those namespaces. It
adds the symbols found to sym_return_val. Arguments are as in
@@ -1332,16 +1322,11 @@ make_symbol_overload_list_using (const char *func_name,
{
/* Mark this import as searched so that the recursive call
does not search it again. */
- struct cleanup *old_chain;
- current->searched = 1;
- old_chain = make_cleanup (reset_directive_searched,
- current);
+ scoped_restore reset_directive_searched
+ = make_scoped_restore (&current->searched, 1);
make_symbol_overload_list_using (func_name,
current->import_src);
-
- current->searched = 0;
- discard_cleanups (old_chain);
}
}