mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
Simplify ada_lookup_encoded_symbol
This patch simplifies ada_lookup_encoded_symbol by having it return its result, rather than returning void and having an out parameter.
This commit is contained in:
parent
9c23c0df0d
commit
3739147957
@ -1322,7 +1322,6 @@ write_object_renaming (struct parser_state *par_state,
|
||||
{
|
||||
char *name;
|
||||
enum { SIMPLE_INDEX, LOWER_BOUND, UPPER_BOUND } slice_state;
|
||||
struct block_symbol sym_info;
|
||||
|
||||
if (max_depth <= 0)
|
||||
error (_("Could not find renamed symbol"));
|
||||
@ -1332,7 +1331,8 @@ write_object_renaming (struct parser_state *par_state,
|
||||
|
||||
name = obstack_strndup (&ada_parser->temp_space, renamed_entity,
|
||||
renamed_entity_len);
|
||||
ada_lookup_encoded_symbol (name, orig_left_context, SEARCH_VFT, &sym_info);
|
||||
block_symbol sym_info = ada_lookup_encoded_symbol (name, orig_left_context,
|
||||
SEARCH_VFT);
|
||||
if (sym_info.symbol == NULL)
|
||||
error (_("Could not find renamed variable: %s"), ada_decode (name).c_str ());
|
||||
else if (sym_info.symbol->aclass () == LOC_TYPEDEF)
|
||||
@ -1390,7 +1390,6 @@ write_object_renaming (struct parser_state *par_state,
|
||||
{
|
||||
const char *end;
|
||||
char *index_name;
|
||||
struct block_symbol index_sym_info;
|
||||
|
||||
end = strchr (renaming_expr, 'X');
|
||||
if (end == NULL)
|
||||
@ -1401,8 +1400,9 @@ write_object_renaming (struct parser_state *par_state,
|
||||
end - renaming_expr);
|
||||
renaming_expr = end;
|
||||
|
||||
ada_lookup_encoded_symbol (index_name, orig_left_context,
|
||||
SEARCH_VFT, &index_sym_info);
|
||||
block_symbol index_sym_info
|
||||
= ada_lookup_encoded_symbol (index_name, orig_left_context,
|
||||
SEARCH_VFT);
|
||||
if (index_sym_info.symbol == NULL)
|
||||
error (_("Could not find %s"), index_name);
|
||||
else if (index_sym_info.symbol->aclass () == LOC_TYPEDEF)
|
||||
|
@ -4792,7 +4792,7 @@ standard_lookup (const char *name, const struct block *block,
|
||||
|
||||
if (lookup_cached_symbol (name, domain, &sym.symbol, NULL))
|
||||
return sym.symbol;
|
||||
ada_lookup_encoded_symbol (name, block, domain, &sym);
|
||||
sym = ada_lookup_encoded_symbol (name, block, domain);
|
||||
cache_symbol (name, domain, sym.symbol, sym.block);
|
||||
return sym.symbol;
|
||||
}
|
||||
@ -5703,15 +5703,11 @@ ada_lookup_symbol_list (const char *name, const struct block *block,
|
||||
|
||||
/* The result is as for ada_lookup_symbol_list with FULL_SEARCH set
|
||||
to 1, but choosing the first symbol found if there are multiple
|
||||
choices.
|
||||
choices. */
|
||||
|
||||
The result is stored in *INFO, which must be non-NULL.
|
||||
If no match is found, INFO->SYM is set to NULL. */
|
||||
|
||||
void
|
||||
block_symbol
|
||||
ada_lookup_encoded_symbol (const char *name, const struct block *block,
|
||||
domain_search_flags domain,
|
||||
struct block_symbol *info)
|
||||
domain_search_flags domain)
|
||||
{
|
||||
/* Since we already have an encoded name, wrap it in '<>' to force a
|
||||
verbatim match. Otherwise, if the name happens to not look like
|
||||
@ -5720,9 +5716,7 @@ ada_lookup_encoded_symbol (const char *name, const struct block *block,
|
||||
would e.g., incorrectly lowercase object renaming names like
|
||||
"R28b" -> "r28b". */
|
||||
std::string verbatim = add_angle_brackets (name);
|
||||
|
||||
gdb_assert (info != NULL);
|
||||
*info = ada_lookup_symbol (verbatim.c_str (), block, domain);
|
||||
return ada_lookup_symbol (verbatim.c_str (), block, domain);
|
||||
}
|
||||
|
||||
/* Return a symbol in DOMAIN matching NAME, in BLOCK0 and enclosing
|
||||
|
@ -236,9 +236,8 @@ extern struct block_symbol ada_lookup_symbol (const char *,
|
||||
const struct block *,
|
||||
domain_search_flags);
|
||||
|
||||
extern void ada_lookup_encoded_symbol
|
||||
(const char *name, const struct block *block, domain_search_flags domain,
|
||||
struct block_symbol *symbol_info);
|
||||
extern block_symbol ada_lookup_encoded_symbol
|
||||
(const char *name, const struct block *block, domain_search_flags domain);
|
||||
|
||||
extern struct bound_minimal_symbol ada_lookup_simple_minsym (const char *,
|
||||
objfile *);
|
||||
|
Loading…
Reference in New Issue
Block a user