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/ada-lang.c | |
parent | a594729cfb10457e0046359d2dde0c28b4185449 (diff) | |
download | gdb-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/ada-lang.c')
-rw-r--r-- | gdb/ada-lang.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index dad2b17..b0dcb4d 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -124,10 +124,10 @@ static int num_defns_collected (struct obstack *); static struct block_symbol *defns_collected (struct obstack *, int); -static struct value *resolve_subexp (struct expression **, int *, int, +static struct value *resolve_subexp (expression_up *, int *, int, struct type *); -static void replace_operator_with_call (struct expression **, int, int, int, +static void replace_operator_with_call (expression_up *, int, int, int, struct symbol *, const struct block *); static int possible_user_operator_p (enum exp_opcode, struct value **); @@ -3235,7 +3235,7 @@ ada_decoded_op_name (enum exp_opcode op) return type is preferred. May change (expand) *EXP. */ static void -resolve (struct expression **expp, int void_context_p) +resolve (expression_up *expp, int void_context_p) { struct type *context_type = NULL; int pc = 0; @@ -3256,7 +3256,7 @@ resolve (struct expression **expp, int void_context_p) are as in ada_resolve, above. */ static struct value * -resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, +resolve_subexp (expression_up *expp, int *pos, int deprocedure_p, struct type *context_type) { int pc = *pos; @@ -3270,7 +3270,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, argvec = NULL; nargs = 0; - exp = *expp; + exp = expp->get (); /* Pass one: resolve operands, saving their types and updating *pos, if needed. */ @@ -3420,7 +3420,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, for (i = 0; i < nargs; i += 1) argvec[i] = resolve_subexp (expp, pos, 1, NULL); argvec[i] = NULL; - exp = *expp; + exp = expp->get (); /* Pass two: perform any resolution on principal operator. */ switch (op) @@ -3515,7 +3515,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, replace_operator_with_call (expp, pc, 0, 0, exp->elts[pc + 2].symbol, exp->elts[pc + 1].block); - exp = *expp; + exp = expp->get (); } break; @@ -3596,7 +3596,7 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, replace_operator_with_call (expp, pc, nargs, 1, candidates[i].symbol, candidates[i].block); - exp = *expp; + exp = expp->get (); } break; @@ -4115,7 +4115,7 @@ get_selections (int *choices, int n_choices, int max_results, arguments. Update *EXPP as needed to hold more space. */ static void -replace_operator_with_call (struct expression **expp, int pc, int nargs, +replace_operator_with_call (expression_up *expp, int pc, int nargs, int oplen, struct symbol *sym, const struct block *block) { @@ -4124,7 +4124,7 @@ replace_operator_with_call (struct expression **expp, int pc, int nargs, struct expression *newexp = (struct expression *) xzalloc (sizeof (struct expression) + EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen)); - struct expression *exp = *expp; + struct expression *exp = expp->get (); newexp->nelts = exp->nelts + 7 - oplen; newexp->language_defn = exp->language_defn; @@ -4140,8 +4140,7 @@ replace_operator_with_call (struct expression **expp, int pc, int nargs, newexp->elts[pc + 4].block = block; newexp->elts[pc + 5].symbol = sym; - *expp = newexp; - xfree (exp); + expp->reset (newexp); } /* Type-class predicates */ |