diff options
author | Tom Tromey <tom@tromey.com> | 2017-11-22 21:45:53 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-12-30 17:05:37 -0700 |
commit | e9d9f57e11db6427db347bc5b9b100071355e63f (patch) | |
tree | b431b37b9a20e1a406b30be36aee0f36489ef5ec /gdb/stap-probe.c | |
parent | Automatic date update in version.in (diff) | |
download | binutils-gdb-e9d9f57e11db6427db347bc5b9b100071355e63f.tar.gz binutils-gdb-e9d9f57e11db6427db347bc5b9b100071355e63f.tar.bz2 binutils-gdb-e9d9f57e11db6427db347bc5b9b100071355e63f.zip |
C++-ify parser_state
This mildly C++-ifies parser_state and stap_parse_info -- just enough
to remove some cleanups.
This version includes the changes implemented by Simon.
Regression tested by the buildbot.
gdb/ChangeLog
2017-12-30 Tom Tromey <tom@tromey.com>
Simon Marchi <simon.marchi@ericsson.com>
* stap-probe.h (struct stap_parse_info): Add constructor,
destructor.
* stap-probe.c (stap_parse_argument): Update.
* rust-exp.y (rust_lex_tests): Update.
* parser-defs.h (struct parser_state): Add constructor,
destructor, release method.
<expout>: Change type to expression_up.
(null_post_parser): Change type.
(initialize_expout, reallocate_expout): Remove.
* parse.c (parser_state::parser_state): Rename from
initialize_expout.
(parser_state::release): Rename from reallocate_expout.
(write_exp_elt, parse_exp_in_context_1, increase_expout_size):
Update.
(null_post_parser): Change type of "exp".
* dtrace-probe.c (dtrace_probe::build_arg_exprs): Update.
* ada-lang.c (resolve, resolve_subexp)
(replace_operator_with_call): Change type of "expp".
* language.h (struct language_defn) <la_post_parser>: Change type
of "expp".
Diffstat (limited to 'gdb/stap-probe.c')
-rw-r--r-- | gdb/stap-probe.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c index 9f4e00845a4..47e370c0ac6 100644 --- a/gdb/stap-probe.c +++ b/gdb/stap-probe.c @@ -1146,25 +1146,14 @@ static expression_up stap_parse_argument (const char **arg, struct type *atype, struct gdbarch *gdbarch) { - struct stap_parse_info p; - struct cleanup *back_to; - /* We need to initialize the expression buffer, in order to begin our parsing efforts. We use language_c here because we may need to do pointer arithmetics. */ - initialize_expout (&p.pstate, 10, language_def (language_c), gdbarch); - back_to = make_cleanup (free_current_contents, &p.pstate.expout); - - p.saved_arg = *arg; - p.arg = *arg; - p.arg_type = atype; - p.gdbarch = gdbarch; - p.inside_paren_p = 0; + struct stap_parse_info p (*arg, atype, 10, language_def (language_c), + gdbarch); stap_parse_argument_1 (&p, 0, STAP_OPERAND_PREC_NONE); - discard_cleanups (back_to); - gdb_assert (p.inside_paren_p == 0); /* Casting the final expression to the appropriate type. */ @@ -1172,13 +1161,10 @@ stap_parse_argument (const char **arg, struct type *atype, write_exp_elt_type (&p.pstate, atype); write_exp_elt_opcode (&p.pstate, UNOP_CAST); - reallocate_expout (&p.pstate); - p.arg = skip_spaces (p.arg); *arg = p.arg; - /* We can safely return EXPOUT here. */ - return expression_up (p.pstate.expout); + return p.pstate.release (); } /* Implementation of 'parse_arguments' method. */ |