aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-03-14 12:13:30 -0600
committerTom Tromey <tromey@adacore.com>2024-04-02 11:24:27 -0600
commit48497d85e3b839b65d3376fcb8d345680ba68926 (patch)
treecda19cf37192c5054285b31cf88fdaf17696b2ec /gdb/ada-exp.y
parentb64e3e1c36eec33cd535cee7ff65de0e3e826e31 (diff)
downloadgdb-48497d85e3b839b65d3376fcb8d345680ba68926.zip
gdb-48497d85e3b839b65d3376fcb8d345680ba68926.tar.gz
gdb-48497d85e3b839b65d3376fcb8d345680ba68926.tar.bz2
Move "int_storage" global into ada_parse_state
This patch moves the "int_storage" global into ada_parse_state.
Diffstat (limited to 'gdb/ada-exp.y')
-rw-r--r--gdb/ada-exp.y17
1 files changed, 11 insertions, 6 deletions
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 80c1edc..cb0618c 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -75,8 +75,19 @@ struct ada_parse_state
std::string find_completion_bounds ();
+ const gdb_mpz *push_integer (gdb_mpz &&val)
+ {
+ auto &result = m_int_storage.emplace_back (new gdb_mpz (std::move (val)));
+ return result.get ();
+ }
+
private:
+ /* We don't have a good way to manage non-POD data in Yacc, so store
+ values here. The storage here is only valid for the duration of
+ the parse. */
+ std::vector<std::unique_ptr<gdb_mpz>> m_int_storage;
+
/* The original expression string. */
const char *m_original_expr;
};
@@ -85,11 +96,6 @@ private:
static ada_parse_state *ada_parser;
-/* We don't have a good way to manage non-POD data in Yacc, so store
- values here. The storage here is only valid for the duration of
- the parse. */
-static std::vector<std::unique_ptr<gdb_mpz>> int_storage;
-
int yyparse (void);
static int yylex (void);
@@ -1252,7 +1258,6 @@ ada_parse (struct parser_state *par_state)
obstack_init (&temp_parse_space);
components.clear ();
associations.clear ();
- int_storage.clear ();
assignments.clear ();
iterated_associations.clear ();