* ada-lang.c (resolve_subexp): Update.

(ada_lookup_symbol_list): Add 'full_search' argument.
	(ada_iterate_over_symbols): Pass 0 as full_search argument to
	ada_lookup_symbol_list.
	(ada_lookup_encoded_symbol): Update.
	(get_var_value): Update.
	* ada-exp.y (block_lookup): Update.
	(write_var_or_type): Update.
	(write_name_assoc): Update.
	* ada-lang.h (ada_lookup_symbol_list): Update.
This commit is contained in:
Tom Tromey
2012-02-01 15:49:34 +00:00
parent 8b971f9fe9
commit d9680e739f
4 changed files with 33 additions and 16 deletions

View File

@@ -1,3 +1,16 @@
2012-02-01 Tom Tromey <tromey@redhat.com>
* ada-lang.c (resolve_subexp): Update.
(ada_lookup_symbol_list): Add 'full_search' argument.
(ada_iterate_over_symbols): Pass 0 as full_search argument to
ada_lookup_symbol_list.
(ada_lookup_encoded_symbol): Update.
(get_var_value): Update.
* ada-exp.y (block_lookup): Update.
(write_var_or_type): Update.
(write_name_assoc): Update.
* ada-lang.h (ada_lookup_symbol_list): Update.
2012-01-31 Tom Tromey <tromey@redhat.com> 2012-01-31 Tom Tromey <tromey@redhat.com>
* language.h (struct language_defn) <la_iterate_over_symbols>: Fix * language.h (struct language_defn) <la_iterate_over_symbols>: Fix

View File

@@ -1021,7 +1021,7 @@ block_lookup (struct block *context, char *raw_name)
else else
name = ada_encode (raw_name); name = ada_encode (raw_name);
nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms); nsyms = ada_lookup_symbol_list (name, context, VAR_DOMAIN, &syms, 1);
if (context == NULL if (context == NULL
&& (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK)) && (nsyms == 0 || SYMBOL_CLASS (syms[0].sym) != LOC_BLOCK))
symtab = lookup_symtab (name); symtab = lookup_symtab (name);
@@ -1278,7 +1278,7 @@ write_var_or_type (struct block *block, struct stoken name0)
encoded_name[tail_index] = '\0'; encoded_name[tail_index] = '\0';
nsyms = ada_lookup_symbol_list (encoded_name, block, nsyms = ada_lookup_symbol_list (encoded_name, block,
VAR_DOMAIN, &syms); VAR_DOMAIN, &syms, 1);
encoded_name[tail_index] = terminator; encoded_name[tail_index] = terminator;
/* A single symbol may rename a package or object. */ /* A single symbol may rename a package or object. */
@@ -1427,7 +1427,7 @@ write_name_assoc (struct stoken name)
{ {
struct ada_symbol_info *syms; struct ada_symbol_info *syms;
int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block, int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
VAR_DOMAIN, &syms); VAR_DOMAIN, &syms, 1);
if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF) if (nsyms != 1 || SYMBOL_CLASS (syms[0].sym) == LOC_TYPEDEF)
write_exp_op_with_string (OP_NAME, name); write_exp_op_with_string (OP_NAME, name);
else else

View File

@@ -3057,7 +3057,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME
(exp->elts[pc + 2].symbol), (exp->elts[pc + 2].symbol),
exp->elts[pc + 1].block, VAR_DOMAIN, exp->elts[pc + 1].block, VAR_DOMAIN,
&candidates); &candidates, 1);
if (n_candidates > 1) if (n_candidates > 1)
{ {
@@ -3149,7 +3149,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME ada_lookup_symbol_list (SYMBOL_LINKAGE_NAME
(exp->elts[pc + 5].symbol), (exp->elts[pc + 5].symbol),
exp->elts[pc + 4].block, VAR_DOMAIN, exp->elts[pc + 4].block, VAR_DOMAIN,
&candidates); &candidates, 1);
if (n_candidates == 1) if (n_candidates == 1)
i = 0; i = 0;
else else
@@ -3201,7 +3201,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p,
n_candidates = n_candidates =
ada_lookup_symbol_list (ada_encode (ada_decoded_op_name (op)), ada_lookup_symbol_list (ada_encode (ada_decoded_op_name (op)),
(struct block *) NULL, VAR_DOMAIN, (struct block *) NULL, VAR_DOMAIN,
&candidates); &candidates, 1);
i = ada_resolve_function (candidates, n_candidates, argvec, nargs, i = ada_resolve_function (candidates, n_candidates, argvec, nargs,
ada_decoded_op_name (op), NULL); ada_decoded_op_name (op), NULL);
if (i < 0) if (i < 0)
@@ -4980,15 +4980,17 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
symbol match within the nest of blocks whose innermost member is BLOCK0, symbol match within the nest of blocks whose innermost member is BLOCK0,
is the one match returned (no other matches in that or is the one match returned (no other matches in that or
enclosing blocks is returned). If there are any matches in or enclosing blocks is returned). If there are any matches in or
surrounding BLOCK0, then these alone are returned. Otherwise, the surrounding BLOCK0, then these alone are returned. Otherwise, if
search extends to global and file-scope (static) symbol tables. FULL_SEARCH is non-zero, then the search extends to global and
file-scope (static) symbol tables.
Names prefixed with "standard__" are handled specially: "standard__" Names prefixed with "standard__" are handled specially: "standard__"
is first stripped off, and only static and global symbols are searched. */ is first stripped off, and only static and global symbols are searched. */
int int
ada_lookup_symbol_list (const char *name0, const struct block *block0, ada_lookup_symbol_list (const char *name0, const struct block *block0,
domain_enum namespace, domain_enum namespace,
struct ada_symbol_info **results) struct ada_symbol_info **results,
int full_search)
{ {
struct symbol *sym; struct symbol *sym;
struct block *block; struct block *block;
@@ -5026,7 +5028,7 @@ ada_lookup_symbol_list (const char *name0, const struct block *block0,
ada_add_local_symbols (&symbol_list_obstack, name, block, namespace, ada_add_local_symbols (&symbol_list_obstack, name, block, namespace,
wild_match); wild_match);
if (num_defns_collected (&symbol_list_obstack) > 0) if (num_defns_collected (&symbol_list_obstack) > 0 || !full_search)
goto done; goto done;
/* No non-global symbols found. Check our cache to see if we have /* No non-global symbols found. Check our cache to see if we have
@@ -5106,7 +5108,7 @@ ada_iterate_over_symbols (const struct block *block,
int ndefs, i; int ndefs, i;
struct ada_symbol_info *results; struct ada_symbol_info *results;
ndefs = ada_lookup_symbol_list (name, block, domain, &results); ndefs = ada_lookup_symbol_list (name, block, domain, &results, 0);
for (i = 0; i < ndefs; ++i) for (i = 0; i < ndefs; ++i)
{ {
if (! (*callback) (results[i].sym, data)) if (! (*callback) (results[i].sym, data))
@@ -5121,7 +5123,8 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block0,
struct ada_symbol_info *candidates; struct ada_symbol_info *candidates;
int n_candidates; int n_candidates;
n_candidates = ada_lookup_symbol_list (name, block0, namespace, &candidates); n_candidates = ada_lookup_symbol_list (name, block0, namespace, &candidates,
1);
if (n_candidates == 0) if (n_candidates == 0)
return NULL; return NULL;
@@ -10359,7 +10362,7 @@ get_var_value (char *name, char *err_msg)
int nsyms; int nsyms;
nsyms = ada_lookup_symbol_list (name, get_selected_block (0), VAR_DOMAIN, nsyms = ada_lookup_symbol_list (name, get_selected_block (0), VAR_DOMAIN,
&syms); &syms, 1);
if (nsyms != 1) if (nsyms != 1)
{ {

View File

@@ -219,7 +219,8 @@ extern enum language ada_update_initial_language (enum language);
extern void clear_ada_sym_cache (void); extern void clear_ada_sym_cache (void);
extern int ada_lookup_symbol_list (const char *, const struct block *, extern int ada_lookup_symbol_list (const char *, const struct block *,
domain_enum, struct ada_symbol_info**); domain_enum, struct ada_symbol_info**,
int);
extern char *ada_fold_name (const char *); extern char *ada_fold_name (const char *);