+2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (resolve): Rename to ada_language::post_parser.
+ (ada_language_data): Delete la_post_parser initializer.
+ (ada_language::post_parser): New member function.
+ * c-lang.c (c_language_data): Delete la_post_parser initializer.
+ (cplus_language_data): Likewise.
+ (asm_language_data): Likewise.
+ (minimal_language_data): Likewise.
+ * d-lang.c (d_language_data): Likewise.
+ * f-lang.c (f_language_data): Likewise.
+ * go-lang.c (go_language_data): Likewise.
+ * language.c (unknown_language_data): Likewise.
+ (auto_language_data): Likewise.
+ * language.h (language_data): Delete la_post_parser field.
+ (language_defn::post_parser): New member function.
+ * m2-lang.c (m2_language_data): Delete la_post_parser initializer.
+ * objc-lang.c (objc_language_data): Likewise.
+ * opencl-lang.c (opencl_language_data): Likewise.
+ * p-lang.c (pascal_language_data): Likewise.
+ * parse.c (parse_exp_in_context): Update call to post_parser.
+ (null_post_parser): Delete definition.
+ * parser-defs.h (null_post_parser): Delete declaration.
+ * rust-lang.c (rust_language_data): Delete la_post_parser
+ initializer.
+
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (parse): Rename to ada_language::parser.
return n_chosen;
}
-/* Same as evaluate_type (*EXP), but resolves ambiguous symbol
- references (marked by OP_VAR_VALUE nodes in which the symbol has an
- undefined namespace) and converts operators that are
- user-defined into appropriate function calls. If CONTEXT_TYPE is
- non-null, it provides a preferred result type [at the moment, only
- type void has any effect---causing procedures to be preferred over
- functions in calls]. A null CONTEXT_TYPE indicates that a non-void
- return type is preferred. May change (expand) *EXP. */
-
-static void
-resolve (expression_up *expp, int void_context_p, int parse_completion,
- innermost_block_tracker *tracker)
-{
- struct type *context_type = NULL;
- int pc = 0;
-
- if (void_context_p)
- context_type = builtin_type ((*expp)->gdbarch)->builtin_void;
-
- resolve_subexp (expp, &pc, 1, context_type, parse_completion, tracker);
-}
-
/* Resolve the operator of the subexpression beginning at
position *POS of *EXPP. "Resolving" consists of replacing
the symbols that have undefined namespaces in OP_VAR_VALUE nodes
macro_expansion_no,
ada_extensions,
&ada_exp_descriptor,
- resolve,
ada_printchar, /* Print a character constant */
ada_printstr, /* Function to print string constant */
emit_char, /* Function to print single char (not used) */
return ada_parse (ps);
}
+ /* See language.h.
+
+ Same as evaluate_type (*EXP), but resolves ambiguous symbol references
+ (marked by OP_VAR_VALUE nodes in which the symbol has an undefined
+ namespace) and converts operators that are user-defined into
+ appropriate function calls. If CONTEXT_TYPE is non-null, it provides
+ a preferred result type [at the moment, only type void has any
+ effect---causing procedures to be preferred over functions in calls].
+ A null CONTEXT_TYPE indicates that a non-void return type is
+ preferred. May change (expand) *EXP. */
+
+ void post_parser (expression_up *expp, int void_context_p, int completing,
+ innermost_block_tracker *tracker) const override
+ {
+ struct type *context_type = NULL;
+ int pc = 0;
+
+ if (void_context_p)
+ context_type = builtin_type ((*expp)->gdbarch)->builtin_void;
+
+ resolve_subexp (expp, &pc, 1, context_type, completing, tracker);
+ }
+
protected:
/* See language.h. */
macro_expansion_c,
c_extensions,
&exp_descriptor_c,
- null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
macro_expansion_c,
cplus_extensions,
&exp_descriptor_c,
- null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
macro_expansion_c,
asm_extensions,
&exp_descriptor_c,
- null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
macro_expansion_c,
NULL,
&exp_descriptor_c,
- null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
macro_expansion_no,
d_extensions,
&exp_descriptor_c,
- null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
macro_expansion_no,
f_extensions,
&exp_descriptor_f,
- null_post_parser,
f_printchar, /* Print character constant */
f_printstr, /* function to print string constant */
f_emit_char, /* Function to print a single character */
macro_expansion_no,
NULL,
&exp_descriptor_c,
- null_post_parser,
c_printchar, /* Print a character constant. */
c_printstr, /* Function to print string constant. */
c_emit_char, /* Print a single char. */
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- null_post_parser,
unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
unk_lang_emit_char,
macro_expansion_no,
NULL,
&exp_descriptor_standard,
- null_post_parser,
unk_lang_printchar, /* Print character constant */
unk_lang_printstr,
unk_lang_emit_char,
const struct exp_descriptor *la_exp_desc;
- /* Given an expression *EXPP created by prefixifying the result of
- la_parser, perform any remaining processing necessary to complete
- its translation. *EXPP may change; la_post_parser is responsible
- for releasing its previous contents, if necessary. If
- VOID_CONTEXT_P, then no value is expected from the expression.
- If COMPLETING is non-zero, then the expression has been parsed
- for completion, not evaluation. */
-
- void (*la_post_parser) (expression_up *expp, int void_context_p,
- int completing, innermost_block_tracker *tracker);
-
void (*la_printchar) (int ch, struct type *chtype,
struct ui_file * stream);
virtual int parser (struct parser_state *ps) const;
+ /* Given an expression *EXPP created by prefixifying the result of
+ la_parser, perform any remaining processing necessary to complete its
+ translation. *EXPP may change; la_post_parser is responsible for
+ releasing its previous contents, if necessary. If VOID_CONTEXT_P,
+ then no value is expected from the expression. If COMPLETING is
+ non-zero, then the expression has been parsed for completion, not
+ evaluation. */
+
+ virtual void post_parser (expression_up *expp, int void_context_p,
+ int completing,
+ innermost_block_tracker *tracker) const
+ {
+ /* By default the post-parser does nothing. */
+ }
+
protected:
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
macro_expansion_no,
NULL,
&exp_descriptor_modula2,
- null_post_parser,
m2_printchar, /* Print character constant */
m2_printstr, /* function to print string constant */
m2_emit_char, /* Function to print a single character */
macro_expansion_c,
objc_extensions,
&exp_descriptor_standard,
- null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char,
macro_expansion_c,
NULL,
&exp_descriptor_opencl,
- null_post_parser,
c_printchar, /* Print a character constant */
c_printstr, /* Function to print string constant */
c_emit_char, /* Print a single char */
macro_expansion_no,
p_extensions,
&exp_descriptor_standard,
- null_post_parser,
pascal_printchar, /* Print a character constant */
pascal_printstr, /* Function to print string constant */
pascal_emit_char, /* Print a single char */
if (out_subexp)
*out_subexp = subexp;
- lang->la_post_parser (&result, void_context_p, ps.parse_completion,
- tracker);
+ lang->post_parser (&result, void_context_p, ps.parse_completion, tracker);
if (expressiondebug)
dump_prefix_expression (result.get (), gdb_stdlog);
return value_type (val);
}
-/* A post-parser that does nothing. */
-
-void
-null_post_parser (expression_up *exp, int void_context_p, int completin,
- innermost_block_tracker *tracker)
-{
-}
-
/* Parse floating point value P of length LEN.
Return false if invalid, true if valid.
The successfully parsed number is stored in DATA in
extern const char *op_name_standard (enum exp_opcode);
-extern void null_post_parser (expression_up *, int, int,
- innermost_block_tracker *);
-
extern bool parse_float (const char *p, int len,
const struct type *type, gdb_byte *data);
\f
macro_expansion_no,
rust_extensions,
&exp_descriptor_rust,
- null_post_parser,
rust_printchar, /* Print a character constant */
rust_printstr, /* Function to print string constant */
rust_emitchar, /* Print a single char */