aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-03-14 12:19:22 -0600
committerTom Tromey <tromey@adacore.com>2024-04-02 11:24:27 -0600
commited08e2b3714e9ea80f68443efb92967300a8897f (patch)
treedb036f7475545f83bc3bc550a28312c87c12455b /gdb/ada-exp.y
parent06c3813858a3b4d9cf624fa687ded27b934fa024 (diff)
downloadgdb-ed08e2b3714e9ea80f68443efb92967300a8897f.zip
gdb-ed08e2b3714e9ea80f68443efb92967300a8897f.tar.gz
gdb-ed08e2b3714e9ea80f68443efb92967300a8897f.tar.bz2
Move "iterated_associations" into ada_parse_state
This patch moves the "iterated_associations" global into ada_parse_state.
Diffstat (limited to 'gdb/ada-exp.y')
-rw-r--r--gdb/ada-exp.y25
1 files changed, 12 insertions, 13 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 207fdcb..09cf6cc 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -96,6 +96,10 @@ struct ada_parse_state
to implement '@', the target name symbol. */
std::vector<ada_assign_up> assignments;
+ /* Track currently active iterated assignment names. */
+ std::unordered_map<std::string, std::vector<ada_index_var_operation *>>
+ iterated_associations;
+
private:
/* We don't have a good way to manage non-POD data in Yacc, so store
@@ -443,10 +447,6 @@ make_tick_completer (struct stoken tok)
(new ada_tick_completer (std::string (tok.ptr, tok.length))));
}
-/* Track currently active iterated assignment names. */
-static std::unordered_map<std::string, std::vector<ada_index_var_operation *>>
- iterated_associations;
-
%}
%union
@@ -1127,12 +1127,12 @@ component_group :
{
std::string name = copy_name ($2);
- auto iter = iterated_associations.find (name);
- if (iter != iterated_associations.end ())
+ auto iter = ada_parser->iterated_associations.find (name);
+ if (iter != ada_parser->iterated_associations.end ())
error (_("Nested use of index parameter '%s'"),
name.c_str ());
- iterated_associations[name] = {};
+ ada_parser->iterated_associations[name] = {};
}
component_associations
{
@@ -1141,12 +1141,12 @@ component_group :
ada_choices_component *choices = choice_component ();
choices->set_associations (pop_associations ($5));
- auto iter = iterated_associations.find (name);
- gdb_assert (iter != iterated_associations.end ());
+ auto iter = ada_parser->iterated_associations.find (name);
+ gdb_assert (iter != ada_parser->iterated_associations.end ());
for (ada_index_var_operation *var : iter->second)
var->set_choices (choices);
- iterated_associations.erase (name);
+ ada_parser->iterated_associations.erase (name);
choices->set_name (std::move (name));
}
@@ -1256,7 +1256,6 @@ ada_parse (struct parser_state *par_state)
lexer_init (yyin); /* (Re-)initialize lexer. */
obstack_free (&temp_parse_space, NULL);
obstack_init (&temp_parse_space);
- iterated_associations.clear ();
int result = yyparse ();
if (!result)
@@ -1706,8 +1705,8 @@ write_var_or_type (struct parser_state *par_state,
if (block == nullptr)
{
- auto iter = iterated_associations.find (name_storage);
- if (iter != iterated_associations.end ())
+ auto iter = ada_parser->iterated_associations.find (name_storage);
+ if (iter != ada_parser->iterated_associations.end ())
{
auto op = std::make_unique<ada_index_var_operation> ();
iter->second.push_back (op.get ());