aboutsummaryrefslogtreecommitdiff
path: root/gdb/dtrace-probe.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-11-22 21:45:53 -0700
committerTom Tromey <tom@tromey.com>2017-12-30 17:05:37 -0700
commite9d9f57e11db6427db347bc5b9b100071355e63f (patch)
treeb431b37b9a20e1a406b30be36aee0f36489ef5ec /gdb/dtrace-probe.c
parenta594729cfb10457e0046359d2dde0c28b4185449 (diff)
downloadgdb-e9d9f57e11db6427db347bc5b9b100071355e63f.zip
gdb-e9d9f57e11db6427db347bc5b9b100071355e63f.tar.gz
gdb-e9d9f57e11db6427db347bc5b9b100071355e63f.tar.bz2
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/dtrace-probe.c')
-rw-r--r--gdb/dtrace-probe.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 3314445..40553d3 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -625,21 +625,15 @@ dtrace_probe::build_arg_exprs (struct gdbarch *gdbarch)
value of the argument when executed at the PC of the probe. */
for (dtrace_probe_arg &arg : m_args)
{
- struct cleanup *back_to;
- struct parser_state pstate;
-
/* Initialize the expression buffer in the parser state. The
language does not matter, since we are using our own
parser. */
- initialize_expout (&pstate, 10, current_language, gdbarch);
- back_to = make_cleanup (free_current_contents, &pstate.expout);
+ parser_state pstate (10, current_language, gdbarch);
/* The argument value, which is ABI dependent and casted to
`long int'. */
gdbarch_dtrace_parse_probe_argument (gdbarch, &pstate, argc);
- discard_cleanups (back_to);
-
/* Casting to the expected type, but only if the type was
recognized at probe load time. Otherwise the argument will
be evaluated as the long integer passed to the probe. */
@@ -650,8 +644,7 @@ dtrace_probe::build_arg_exprs (struct gdbarch *gdbarch)
write_exp_elt_opcode (&pstate, UNOP_CAST);
}
- reallocate_expout (&pstate);
- arg.expr = expression_up (pstate.expout);
+ arg.expr = pstate.release ();
prefixify_expression (arg.expr.get ());
++argc;
}