From 1e58a4a4db997cf09315c22f3da725d1da7f9ee7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 24 Mar 2019 11:20:05 -0600 Subject: Move expression_context_* globals to parser_state This moves the expression_context_block and expression_context_pc globals to be members of parser_state and updates the parsers. gdb/ChangeLog 2019-04-04 Tom Tromey * rust-exp.y (rust_parser::crate_name, rust_parser::super_name) (rust_parser::convert_ast_to_type) (rust_parser::convert_ast_to_expression, rust_lex_tests): Update. * parser-defs.h (struct parser_state) : Add parameters. Initialize new members. : New members. * parse.c (expression_context_block, expression_context_pc): Remove globals. (parse_exp_in_context): Update. * p-exp.y: Update all rules. (yylex): Update. * m2-exp.y: Update all rules. (yylex): Update. * go-exp.y (yylex): Update. * f-exp.y (yylex): Update. * d-exp.y: Update all rules. (yylex): Update. * c-exp.y: Update all rules. (lex_one_token, classify_name, yylex, c_parse): Update. * ada-exp.y (write_var_or_type, write_name_assoc): Update. --- gdb/parser-defs.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'gdb/parser-defs.h') diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 5bc9d25..f895a55 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -86,24 +86,29 @@ struct parser_state : public expr_builder And GDBARCH is the gdbarch to use during parsing. */ parser_state (const struct language_defn *lang, - struct gdbarch *gdbarch) - : expr_builder (lang, gdbarch) + struct gdbarch *gdbarch, + const struct block *context_block, + CORE_ADDR context_pc) + : expr_builder (lang, gdbarch), + expression_context_block (context_block), + expression_context_pc (context_pc) { } DISABLE_COPY_AND_ASSIGN (parser_state); -}; -/* If this is nonzero, this block is used as the lexical context - for symbol names. */ + /* If this is nonzero, this block is used as the lexical context for + symbol names. */ -extern const struct block *expression_context_block; + const struct block * const expression_context_block; -/* If expression_context_block is non-zero, then this is the PC within - the block that we want to evaluate expressions at. When debugging - C or C++ code, we use this to find the exact line we're at, and - then look up the macro definitions active at that point. */ -extern CORE_ADDR expression_context_pc; + /* If expression_context_block is non-zero, then this is the PC + within the block that we want to evaluate expressions at. When + debugging C or C++ code, we use this to find the exact line we're + at, and then look up the macro definitions active at that + point. */ + const CORE_ADDR expression_context_pc; +}; /* When parsing expressions we track the innermost block that was referenced. */ @@ -283,7 +288,7 @@ extern void write_exp_elt_objfile (struct expr_builder *, extern void write_exp_msymbol (struct expr_builder *, struct bound_minimal_symbol); -extern void write_dollar_variable (struct expr_builder *, struct stoken str); +extern void write_dollar_variable (struct parser_state *, struct stoken str); extern void mark_struct_expression (struct expr_builder *); -- cgit v1.1