aboutsummaryrefslogtreecommitdiff
path: root/gdb/p-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-03-24 11:20:05 -0600
committerTom Tromey <tom@tromey.com>2019-04-04 19:55:10 -0600
commit1e58a4a4db997cf09315c22f3da725d1da7f9ee7 (patch)
tree5166626dc2cad5a02581b158edaa245045922ab9 /gdb/p-exp.y
parent37eedb39824dc26c82a92b5515a352d7de0c9b5b (diff)
downloadfsf-binutils-gdb-1e58a4a4db997cf09315c22f3da725d1da7f9ee7.zip
fsf-binutils-gdb-1e58a4a4db997cf09315c22f3da725d1da7f9ee7.tar.gz
fsf-binutils-gdb-1e58a4a4db997cf09315c22f3da725d1da7f9ee7.tar.bz2
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 <tom@tromey.com> * 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) <parser_state>: Add parameters. Initialize new members. <expression_context_block, expression_context_pc>: 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.
Diffstat (limited to 'gdb/p-exp.y')
-rw-r--r--gdb/p-exp.y26
1 files changed, 16 insertions, 10 deletions
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 79b2979..dbccf35 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -784,11 +784,15 @@ typebase /* Implements (approximately): (type-qualifier)* type-specifier */
| TYPENAME
{ $$ = $1.type; }
| STRUCT name
- { $$ = lookup_struct (copy_name ($2),
- expression_context_block); }
+ { $$
+ = lookup_struct (copy_name ($2),
+ pstate->expression_context_block);
+ }
| CLASS name
- { $$ = lookup_struct (copy_name ($2),
- expression_context_block); }
+ { $$
+ = lookup_struct (copy_name ($2),
+ pstate->expression_context_block);
+ }
/* "const" and "volatile" are curently ignored. A type qualifier
after the type is handled in the ptype rule. I think these could
be too. */
@@ -1463,7 +1467,7 @@ yylex (void)
inserted in FPC stabs debug info. */
static const char this_name[] = "this";
- if (lookup_symbol (this_name, expression_context_block,
+ if (lookup_symbol (this_name, pstate->expression_context_block,
VAR_DOMAIN, NULL).symbol)
{
free (uptokstart);
@@ -1513,7 +1517,7 @@ yylex (void)
if (is_a_field)
sym = NULL;
else
- sym = lookup_symbol (tmp, expression_context_block,
+ sym = lookup_symbol (tmp, pstate->expression_context_block,
VAR_DOMAIN, &is_a_field_of_this).symbol;
/* second chance uppercased (as Free Pascal does). */
if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
@@ -1528,7 +1532,7 @@ yylex (void)
if (is_a_field)
sym = NULL;
else
- sym = lookup_symbol (tmp, expression_context_block,
+ sym = lookup_symbol (tmp, pstate->expression_context_block,
VAR_DOMAIN, &is_a_field_of_this).symbol;
}
/* Third chance Capitalized (as GPC does). */
@@ -1550,7 +1554,7 @@ yylex (void)
if (is_a_field)
sym = NULL;
else
- sym = lookup_symbol (tmp, expression_context_block,
+ sym = lookup_symbol (tmp, pstate->expression_context_block,
VAR_DOMAIN, &is_a_field_of_this).symbol;
}
@@ -1645,8 +1649,10 @@ yylex (void)
tmp1 += 2;
memcpy (tmp1, namestart, p - namestart);
tmp1[p - namestart] = '\0';
- cur_sym = lookup_symbol (ncopy, expression_context_block,
- VAR_DOMAIN, NULL).symbol;
+ cur_sym
+ = lookup_symbol (ncopy,
+ pstate->expression_context_block,
+ VAR_DOMAIN, NULL).symbol;
if (cur_sym)
{
if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)