gdb: Convert language la_post_parser field to a method

This commit changes the language_data::la_post_parser function pointer
member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

	* 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.
This commit is contained in:
Andrew Burgess
2020-06-02 14:57:40 +01:00
parent 87afa6523b
commit 1bf9c36374
15 changed files with 65 additions and 61 deletions

View File

@ -3360,28 +3360,6 @@ See set/show multiple-symbol."));
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
@ -13711,7 +13689,6 @@ extern const struct language_data ada_language_data =
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) */
@ -14116,6 +14093,29 @@ public:
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. */