diff options
author | Tom Tromey <tromey@adacore.com> | 2024-03-14 12:13:30 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-04-02 11:24:27 -0600 |
commit | 48497d85e3b839b65d3376fcb8d345680ba68926 (patch) | |
tree | cda19cf37192c5054285b31cf88fdaf17696b2ec /gdb/ada-exp.y | |
parent | b64e3e1c36eec33cd535cee7ff65de0e3e826e31 (diff) | |
download | gdb-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.y | 17 |
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 (); |