gdb: Convert language la_parser field to a method
This commit changes the language_data::la_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 (parse): Rename to ada_language::parser. (ada_language_data): Delete la_parser initializer. (ada_language::parser): New member function, implementation from parse. * c-lang.c (c_language_data): Delete la_parser initializer. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. (d_language::parser): New member function. * f-lang.c (f_language_data): Delete la_parser initializer. (f_language::parser): New member function. * go-lang.c (go_language_data): Delete la_parser initializer. (go_language::parser): New member function. * language.c (unk_lang_parser): Delete. (language_defn::parser): Define new member function. (unknown_language_data): Delete la_parser initializer. (unknown_language::parser): New member function. (auto_language_data): Delete la_parser initializer. (auto_language::parser): New member function. * language.h (language_data): Delete la_parser field. (language_defn::parser): Declare new member function. * m2-lang.c (m2_language_data): Delete la_parser initializer. (m2_language::parser): New member function. * objc-lang.c (objc_language_data): Delete la_parser initializer. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. (pascal_language::parser): New member function. * parse.c (parse_exp_in_context): Update call to parser. * rust-lang.c (rust_language_data): Delete la_parser initializer. (rust_language::parser): New member function.
This commit is contained in:
parent
3084d7a27b
commit
87afa6523b
14 changed files with 113 additions and 35 deletions
|
@ -1,3 +1,37 @@
|
|||
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* ada-lang.c (parse): Rename to ada_language::parser.
|
||||
(ada_language_data): Delete la_parser initializer.
|
||||
(ada_language::parser): New member function, implementation from
|
||||
parse.
|
||||
* c-lang.c (c_language_data): Delete la_parser initializer.
|
||||
(cplus_language_data): Likewise.
|
||||
(asm_language_data): Likewise.
|
||||
(minimal_language_data): Likewise.
|
||||
* d-lang.c (d_language_data): Likewise.
|
||||
(d_language::parser): New member function.
|
||||
* f-lang.c (f_language_data): Delete la_parser initializer.
|
||||
(f_language::parser): New member function.
|
||||
* go-lang.c (go_language_data): Delete la_parser initializer.
|
||||
(go_language::parser): New member function.
|
||||
* language.c (unk_lang_parser): Delete.
|
||||
(language_defn::parser): Define new member function.
|
||||
(unknown_language_data): Delete la_parser initializer.
|
||||
(unknown_language::parser): New member function.
|
||||
(auto_language_data): Delete la_parser initializer.
|
||||
(auto_language::parser): New member function.
|
||||
* language.h (language_data): Delete la_parser field.
|
||||
(language_defn::parser): Declare new member function.
|
||||
* m2-lang.c (m2_language_data): Delete la_parser initializer.
|
||||
(m2_language::parser): New member function.
|
||||
* objc-lang.c (objc_language_data): Delete la_parser initializer.
|
||||
* opencl-lang.c (opencl_language_data): Likewise.
|
||||
* p-lang.c (pascal_language_data): Likewise.
|
||||
(pascal_language::parser): New member function.
|
||||
* parse.c (parse_exp_in_context): Update call to parser.
|
||||
* rust-lang.c (rust_language_data): Delete la_parser initializer.
|
||||
(rust_language::parser): New member function.
|
||||
|
||||
2020-06-23 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||
|
||||
* top.c (print_gdb_configuration): Print --with-python-libdir
|
||||
|
|
|
@ -13534,13 +13534,6 @@ emit_char (int c, struct type *type, struct ui_file *stream, int quoter)
|
|||
ada_emit_char (c, type, stream, quoter, 1);
|
||||
}
|
||||
|
||||
static int
|
||||
parse (struct parser_state *ps)
|
||||
{
|
||||
warnings_issued = 0;
|
||||
return ada_parse (ps);
|
||||
}
|
||||
|
||||
static const struct exp_descriptor ada_exp_descriptor = {
|
||||
ada_print_subexp,
|
||||
ada_operator_length,
|
||||
|
@ -13718,7 +13711,6 @@ extern const struct language_data ada_language_data =
|
|||
macro_expansion_no,
|
||||
ada_extensions,
|
||||
&ada_exp_descriptor,
|
||||
parse,
|
||||
resolve,
|
||||
ada_printchar, /* Print a character constant */
|
||||
ada_printstr, /* Function to print string constant */
|
||||
|
@ -14116,6 +14108,14 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
warnings_issued = 0;
|
||||
return ada_parse (ps);
|
||||
}
|
||||
|
||||
protected:
|
||||
/* See language.h. */
|
||||
|
||||
|
|
|
@ -889,7 +889,6 @@ extern const struct language_data c_language_data =
|
|||
macro_expansion_c,
|
||||
c_extensions,
|
||||
&exp_descriptor_c,
|
||||
c_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant */
|
||||
c_printstr, /* Function to print string constant */
|
||||
|
@ -997,7 +996,6 @@ extern const struct language_data cplus_language_data =
|
|||
macro_expansion_c,
|
||||
cplus_extensions,
|
||||
&exp_descriptor_c,
|
||||
c_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant */
|
||||
c_printstr, /* Function to print string constant */
|
||||
|
@ -1202,7 +1200,6 @@ extern const struct language_data asm_language_data =
|
|||
macro_expansion_c,
|
||||
asm_extensions,
|
||||
&exp_descriptor_c,
|
||||
c_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant */
|
||||
c_printstr, /* Function to print string constant */
|
||||
|
@ -1265,7 +1262,6 @@ extern const struct language_data minimal_language_data =
|
|||
macro_expansion_c,
|
||||
NULL,
|
||||
&exp_descriptor_c,
|
||||
c_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant */
|
||||
c_printstr, /* Function to print string constant */
|
||||
|
|
|
@ -142,7 +142,6 @@ extern const struct language_data d_language_data =
|
|||
macro_expansion_no,
|
||||
d_extensions,
|
||||
&exp_descriptor_c,
|
||||
d_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant. */
|
||||
c_printstr, /* Function to print string constant. */
|
||||
|
@ -273,6 +272,13 @@ public:
|
|||
{
|
||||
return d_lookup_symbol_nonlocal (this, name, block, domain);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
return d_parse (ps);
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the D language class. */
|
||||
|
|
|
@ -564,7 +564,6 @@ extern const struct language_data f_language_data =
|
|||
macro_expansion_no,
|
||||
f_extensions,
|
||||
&exp_descriptor_f,
|
||||
f_parse, /* parser */
|
||||
null_post_parser,
|
||||
f_printchar, /* Print character constant */
|
||||
f_printstr, /* function to print string constant */
|
||||
|
@ -713,6 +712,13 @@ public:
|
|||
return cp_lookup_symbol_nonlocal (this, name, block, domain);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
return f_parse (ps);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/* See language.h. */
|
||||
|
|
|
@ -527,7 +527,6 @@ extern const struct language_data go_language_data =
|
|||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_c,
|
||||
go_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant. */
|
||||
c_printstr, /* Function to print string constant. */
|
||||
|
@ -638,6 +637,13 @@ public:
|
|||
{
|
||||
return go_value_print_inner (val, stream, recurse, options);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
return go_parse (ps);
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the Go language class. */
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#include <algorithm>
|
||||
#include "gdbarch.h"
|
||||
|
||||
static int unk_lang_parser (struct parser_state *);
|
||||
|
||||
static void set_range_case (void);
|
||||
|
||||
static void unk_lang_emit_char (int c, struct type *type,
|
||||
|
@ -643,6 +641,14 @@ language_defn::value_print (struct value *val, struct ui_file *stream,
|
|||
|
||||
/* See language.h. */
|
||||
|
||||
int
|
||||
language_defn::parser (struct parser_state *ps) const
|
||||
{
|
||||
return c_parse (ps);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
void
|
||||
language_defn::value_print_inner
|
||||
(struct value *val, struct ui_file *stream, int recurse,
|
||||
|
@ -718,12 +724,6 @@ default_is_string_type_p (struct type *type)
|
|||
|
||||
/* Define the language that is no language. */
|
||||
|
||||
static int
|
||||
unk_lang_parser (struct parser_state *ps)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
unk_lang_emit_char (int c, struct type *type, struct ui_file *stream,
|
||||
int quoter)
|
||||
|
@ -777,7 +777,6 @@ extern const struct language_data unknown_language_data =
|
|||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_standard,
|
||||
unk_lang_parser,
|
||||
null_post_parser,
|
||||
unk_lang_printchar, /* Print character constant */
|
||||
unk_lang_printstr,
|
||||
|
@ -842,6 +841,14 @@ public:
|
|||
{
|
||||
error (_("unimplemented unknown_language::value_print_inner called"));
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
/* No parsing is done, just claim success. */
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the unknown language class. */
|
||||
|
@ -861,7 +868,6 @@ extern const struct language_data auto_language_data =
|
|||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_standard,
|
||||
unk_lang_parser,
|
||||
null_post_parser,
|
||||
unk_lang_printchar, /* Print character constant */
|
||||
unk_lang_printstr,
|
||||
|
@ -926,6 +932,14 @@ public:
|
|||
{
|
||||
error (_("unimplemented auto_language::value_print_inner called"));
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
/* No parsing is done, just claim success. */
|
||||
return 1;
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the fake "auto" language. */
|
||||
|
|
|
@ -225,10 +225,6 @@ struct language_data
|
|||
|
||||
const struct exp_descriptor *la_exp_desc;
|
||||
|
||||
/* Parser function. */
|
||||
|
||||
int (*la_parser) (struct parser_state *);
|
||||
|
||||
/* 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
|
||||
|
@ -540,6 +536,10 @@ struct language_defn : language_data
|
|||
(struct value *val, struct ui_file *stream, int recurse,
|
||||
const struct value_print_options *options) const;
|
||||
|
||||
/* Parser function. */
|
||||
|
||||
virtual int parser (struct parser_state *ps) const;
|
||||
|
||||
protected:
|
||||
|
||||
/* This is the overridable part of the GET_SYMBOL_NAME_MATCHER method.
|
||||
|
|
|
@ -362,7 +362,6 @@ extern const struct language_data m2_language_data =
|
|||
macro_expansion_no,
|
||||
NULL,
|
||||
&exp_descriptor_modula2,
|
||||
m2_parse, /* parser */
|
||||
null_post_parser,
|
||||
m2_printchar, /* Print character constant */
|
||||
m2_printstr, /* function to print string constant */
|
||||
|
@ -430,6 +429,13 @@ public:
|
|||
{
|
||||
return m2_value_print_inner (val, stream, recurse, options);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
return m2_parse (ps);
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the M2 language. */
|
||||
|
|
|
@ -337,7 +337,6 @@ extern const struct language_data objc_language_data =
|
|||
macro_expansion_c,
|
||||
objc_extensions,
|
||||
&exp_descriptor_standard,
|
||||
c_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant */
|
||||
c_printstr, /* Function to print string constant */
|
||||
|
|
|
@ -1016,7 +1016,6 @@ extern const struct language_data opencl_language_data =
|
|||
macro_expansion_c,
|
||||
NULL,
|
||||
&exp_descriptor_opencl,
|
||||
c_parse,
|
||||
null_post_parser,
|
||||
c_printchar, /* Print a character constant */
|
||||
c_printstr, /* Function to print string constant */
|
||||
|
|
|
@ -393,7 +393,6 @@ extern const struct language_data pascal_language_data =
|
|||
macro_expansion_no,
|
||||
p_extensions,
|
||||
&exp_descriptor_standard,
|
||||
pascal_parse,
|
||||
null_post_parser,
|
||||
pascal_printchar, /* Print a character constant */
|
||||
pascal_printstr, /* Function to print string constant */
|
||||
|
@ -492,6 +491,13 @@ public:
|
|||
{
|
||||
return pascal_value_print_inner (val, stream, recurse, options);
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
return pascal_parse (ps);
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the Pascal language class. */
|
||||
|
|
|
@ -1119,7 +1119,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
|||
|
||||
try
|
||||
{
|
||||
lang->la_parser (&ps);
|
||||
lang->parser (&ps);
|
||||
}
|
||||
catch (const gdb_exception &except)
|
||||
{
|
||||
|
|
|
@ -1989,7 +1989,6 @@ extern const struct language_data rust_language_data =
|
|||
macro_expansion_no,
|
||||
rust_extensions,
|
||||
&exp_descriptor_rust,
|
||||
rust_parse,
|
||||
null_post_parser,
|
||||
rust_printchar, /* Print a character constant */
|
||||
rust_printstr, /* Function to print string constant */
|
||||
|
@ -2142,6 +2141,13 @@ public:
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* See language.h. */
|
||||
|
||||
int parser (struct parser_state *ps) const override
|
||||
{
|
||||
return rust_parse (ps);
|
||||
}
|
||||
};
|
||||
|
||||
/* Single instance of the Rust language class. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue