mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 06:45:56 +08:00
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.
This commit is contained in:
@ -1,3 +1,26 @@
|
||||
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.
|
||||
|
||||
2019-04-04 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* gdbarch.h, gdbarch.c: Rebuild.
|
||||
|
@ -1203,7 +1203,7 @@ write_var_or_type (struct parser_state *par_state,
|
||||
int name_len;
|
||||
|
||||
if (block == NULL)
|
||||
block = expression_context_block;
|
||||
block = par_state->expression_context_block;
|
||||
|
||||
encoded_name = ada_encode (name0.ptr);
|
||||
name_len = strlen (encoded_name);
|
||||
@ -1343,7 +1343,7 @@ write_var_or_type (struct parser_state *par_state,
|
||||
|
||||
if (!have_full_symbols () && !have_partial_symbols () && block == NULL)
|
||||
error (_("No symbol table is loaded. Use the \"file\" command."));
|
||||
if (block == expression_context_block)
|
||||
if (block == par_state->expression_context_block)
|
||||
error (_("No definition of \"%s\" in current context."), name0.ptr);
|
||||
else
|
||||
error (_("No definition of \"%s\" in specified context."), name0.ptr);
|
||||
@ -1376,7 +1376,8 @@ write_name_assoc (struct parser_state *par_state, struct stoken name)
|
||||
if (strchr (name.ptr, '.') == NULL)
|
||||
{
|
||||
std::vector<struct block_symbol> syms;
|
||||
int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
|
||||
int nsyms = ada_lookup_symbol_list (name.ptr,
|
||||
par_state->expression_context_block,
|
||||
VAR_DOMAIN, &syms);
|
||||
|
||||
if (nsyms != 1 || SYMBOL_CLASS (syms[0].symbol) == LOC_TYPEDEF)
|
||||
|
53
gdb/c-exp.y
53
gdb/c-exp.y
@ -559,8 +559,8 @@ exp : UNKNOWN_CPP_NAME '('
|
||||
/* This could potentially be a an argument defined
|
||||
lookup function (Koenig). */
|
||||
write_exp_elt_opcode (pstate, OP_ADL_FUNC);
|
||||
write_exp_elt_block (pstate,
|
||||
expression_context_block);
|
||||
write_exp_elt_block
|
||||
(pstate, pstate->expression_context_block);
|
||||
write_exp_elt_sym (pstate,
|
||||
NULL); /* Placeholder. */
|
||||
write_exp_string (pstate, $1.stoken);
|
||||
@ -1400,8 +1400,10 @@ typebase
|
||||
NULL,
|
||||
0); }
|
||||
| STRUCT name
|
||||
{ $$ = lookup_struct (copy_name ($2),
|
||||
expression_context_block); }
|
||||
{ $$
|
||||
= lookup_struct (copy_name ($2),
|
||||
pstate->expression_context_block);
|
||||
}
|
||||
| STRUCT COMPLETE
|
||||
{
|
||||
mark_completion_tag (TYPE_CODE_STRUCT, "", 0);
|
||||
@ -1414,8 +1416,9 @@ typebase
|
||||
$$ = NULL;
|
||||
}
|
||||
| CLASS name
|
||||
{ $$ = lookup_struct (copy_name ($2),
|
||||
expression_context_block); }
|
||||
{ $$ = lookup_struct
|
||||
(copy_name ($2), pstate->expression_context_block);
|
||||
}
|
||||
| CLASS COMPLETE
|
||||
{
|
||||
mark_completion_tag (TYPE_CODE_STRUCT, "", 0);
|
||||
@ -1428,8 +1431,10 @@ typebase
|
||||
$$ = NULL;
|
||||
}
|
||||
| UNION name
|
||||
{ $$ = lookup_union (copy_name ($2),
|
||||
expression_context_block); }
|
||||
{ $$
|
||||
= lookup_union (copy_name ($2),
|
||||
pstate->expression_context_block);
|
||||
}
|
||||
| UNION COMPLETE
|
||||
{
|
||||
mark_completion_tag (TYPE_CODE_UNION, "", 0);
|
||||
@ -1443,7 +1448,8 @@ typebase
|
||||
}
|
||||
| ENUM name
|
||||
{ $$ = lookup_enum (copy_name ($2),
|
||||
expression_context_block); }
|
||||
pstate->expression_context_block);
|
||||
}
|
||||
| ENUM COMPLETE
|
||||
{
|
||||
mark_completion_tag (TYPE_CODE_ENUM, "", 0);
|
||||
@ -1475,8 +1481,9 @@ typebase
|
||||
reduced; template recognition happens by lookahead
|
||||
in the token processing code in yylex. */
|
||||
| TEMPLATE name '<' type '>'
|
||||
{ $$ = lookup_template_type(copy_name($2), $4,
|
||||
expression_context_block);
|
||||
{ $$ = lookup_template_type
|
||||
(copy_name($2), $4,
|
||||
pstate->expression_context_block);
|
||||
}
|
||||
| const_or_volatile_or_space_identifier_noopt typebase
|
||||
{ $$ = follow_types ($2); }
|
||||
@ -1733,10 +1740,11 @@ name_not_typename : NAME
|
||||
struct field_of_this_result is_a_field_of_this;
|
||||
|
||||
$$.stoken = $1;
|
||||
$$.sym = lookup_symbol ($1.ptr,
|
||||
expression_context_block,
|
||||
VAR_DOMAIN,
|
||||
&is_a_field_of_this);
|
||||
$$.sym
|
||||
= lookup_symbol ($1.ptr,
|
||||
pstate->expression_context_block,
|
||||
VAR_DOMAIN,
|
||||
&is_a_field_of_this);
|
||||
$$.is_a_field_of_this
|
||||
= is_a_field_of_this.type != NULL;
|
||||
}
|
||||
@ -2869,7 +2877,8 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
|
||||
{
|
||||
struct field_of_this_result is_a_field_of_this;
|
||||
|
||||
if (lookup_symbol (copy, expression_context_block,
|
||||
if (lookup_symbol (copy,
|
||||
pstate->expression_context_block,
|
||||
VAR_DOMAIN,
|
||||
(par_state->language ()->la_language
|
||||
== language_cplus ? &is_a_field_of_this
|
||||
@ -3007,7 +3016,8 @@ classify_name (struct parser_state *par_state, const struct block *block,
|
||||
struct symbol *sym;
|
||||
|
||||
yylval.theclass.theclass = Class;
|
||||
sym = lookup_struct_typedef (copy, expression_context_block, 1);
|
||||
sym = lookup_struct_typedef (copy,
|
||||
par_state->expression_context_block, 1);
|
||||
if (sym)
|
||||
yylval.theclass.type = SYMBOL_TYPE (sym);
|
||||
return CLASSNAME;
|
||||
@ -3145,7 +3155,7 @@ yylex (void)
|
||||
name-like token. */
|
||||
current.token = lex_one_token (pstate, &is_quoted_name);
|
||||
if (current.token == NAME)
|
||||
current.token = classify_name (pstate, expression_context_block,
|
||||
current.token = classify_name (pstate, pstate->expression_context_block,
|
||||
is_quoted_name, last_lex_was_structop);
|
||||
if (pstate->language ()->la_language != language_cplus
|
||||
|| (current.token != TYPENAME && current.token != COLONCOLON
|
||||
@ -3191,7 +3201,7 @@ yylex (void)
|
||||
else
|
||||
{
|
||||
gdb_assert (current.token == TYPENAME);
|
||||
search_block = expression_context_block;
|
||||
search_block = pstate->expression_context_block;
|
||||
obstack_grow (&name_obstack, current.value.sval.ptr,
|
||||
current.value.sval.length);
|
||||
context_type = current.value.tsym.type;
|
||||
@ -3288,8 +3298,9 @@ c_parse (struct parser_state *par_state)
|
||||
|
||||
gdb::unique_xmalloc_ptr<struct macro_scope> macro_scope;
|
||||
|
||||
if (expression_context_block)
|
||||
macro_scope = sal_macro_scope (find_pc_line (expression_context_pc, 0));
|
||||
if (par_state->expression_context_block)
|
||||
macro_scope
|
||||
= sal_macro_scope (find_pc_line (par_state->expression_context_pc, 0));
|
||||
else
|
||||
macro_scope = default_macro_scope ();
|
||||
if (! macro_scope)
|
||||
|
11
gdb/d-exp.y
11
gdb/d-exp.y
@ -416,8 +416,8 @@ PrimaryExpression:
|
||||
struct block_symbol sym;
|
||||
|
||||
/* Handle VAR, which could be local or global. */
|
||||
sym = lookup_symbol (copy, expression_context_block, VAR_DOMAIN,
|
||||
&is_a_field_of_this);
|
||||
sym = lookup_symbol (copy, pstate->expression_context_block,
|
||||
VAR_DOMAIN, &is_a_field_of_this);
|
||||
if (sym.symbol && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF)
|
||||
{
|
||||
if (symbol_read_needs_frame (sym.symbol))
|
||||
@ -1458,7 +1458,7 @@ yylex (void)
|
||||
if (current.token == IDENTIFIER)
|
||||
{
|
||||
yylval = current.value;
|
||||
current.token = classify_name (pstate, expression_context_block);
|
||||
current.token = classify_name (pstate, pstate->expression_context_block);
|
||||
current.value = yylval;
|
||||
}
|
||||
|
||||
@ -1489,7 +1489,8 @@ yylex (void)
|
||||
yylval.sval.ptr = (char *) obstack_base (&name_obstack);
|
||||
yylval.sval.length = obstack_object_size (&name_obstack);
|
||||
|
||||
current.token = classify_name (pstate, expression_context_block);
|
||||
current.token = classify_name (pstate,
|
||||
pstate->expression_context_block);
|
||||
current.value = yylval;
|
||||
|
||||
/* We keep going until we find a TYPENAME. */
|
||||
@ -1526,7 +1527,7 @@ yylex (void)
|
||||
else
|
||||
{
|
||||
gdb_assert (current.token == TYPENAME);
|
||||
search_block = expression_context_block;
|
||||
search_block = pstate->expression_context_block;
|
||||
obstack_grow (&name_obstack, current.value.sval.ptr,
|
||||
current.value.sval.length);
|
||||
context_type = current.value.tsym.type;
|
||||
|
@ -1274,7 +1274,7 @@ yylex (void)
|
||||
way we can refer to it unconditionally below. */
|
||||
memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
|
||||
|
||||
result = lookup_symbol (tmp, expression_context_block,
|
||||
result = lookup_symbol (tmp, pstate->expression_context_block,
|
||||
lookup_domains[i],
|
||||
pstate->language ()->la_language
|
||||
== language_cplus
|
||||
|
@ -1528,14 +1528,14 @@ yylex (void)
|
||||
return classify_unsafe_function (name2.value.sval);
|
||||
}
|
||||
|
||||
if (package_name_p (copy, expression_context_block))
|
||||
if (package_name_p (copy, pstate->expression_context_block))
|
||||
{
|
||||
popping = 1;
|
||||
yylval.sval = build_packaged_name (current.value.sval.ptr,
|
||||
current.value.sval.length,
|
||||
name2.value.sval.ptr,
|
||||
name2.value.sval.length);
|
||||
return classify_packaged_name (expression_context_block);
|
||||
return classify_packaged_name (pstate->expression_context_block);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1549,7 +1549,7 @@ yylex (void)
|
||||
|
||||
popping = 1;
|
||||
yylval = current.value;
|
||||
return classify_name (pstate, expression_context_block);
|
||||
return classify_name (pstate, pstate->expression_context_block);
|
||||
}
|
||||
|
||||
int
|
||||
|
27
gdb/m2-exp.y
27
gdb/m2-exp.y
@ -508,7 +508,7 @@ block : fblock
|
||||
fblock : BLOCKNAME
|
||||
{ struct symbol *sym
|
||||
= lookup_symbol (copy_name ($1),
|
||||
expression_context_block,
|
||||
pstate->expression_context_block,
|
||||
VAR_DOMAIN, 0).symbol;
|
||||
$$ = sym;}
|
||||
;
|
||||
@ -561,10 +561,11 @@ variable: NAME
|
||||
{ struct block_symbol sym;
|
||||
struct field_of_this_result is_a_field_of_this;
|
||||
|
||||
sym = lookup_symbol (copy_name ($1),
|
||||
expression_context_block,
|
||||
VAR_DOMAIN,
|
||||
&is_a_field_of_this);
|
||||
sym
|
||||
= lookup_symbol (copy_name ($1),
|
||||
pstate->expression_context_block,
|
||||
VAR_DOMAIN,
|
||||
&is_a_field_of_this);
|
||||
|
||||
if (sym.symbol)
|
||||
{
|
||||
@ -596,10 +597,13 @@ variable: NAME
|
||||
|
||||
type
|
||||
: TYPENAME
|
||||
{ $$ = lookup_typename (pstate->language (),
|
||||
pstate->gdbarch (),
|
||||
copy_name ($1),
|
||||
expression_context_block, 0); }
|
||||
{ $$
|
||||
= lookup_typename (pstate->language (),
|
||||
pstate->gdbarch (),
|
||||
copy_name ($1),
|
||||
pstate->expression_context_block,
|
||||
0);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@ -965,12 +969,13 @@ yylex (void)
|
||||
|
||||
if (lookup_symtab (tmp))
|
||||
return BLOCKNAME;
|
||||
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0).symbol;
|
||||
sym = lookup_symbol (tmp, pstate->expression_context_block,
|
||||
VAR_DOMAIN, 0).symbol;
|
||||
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
|
||||
return BLOCKNAME;
|
||||
if (lookup_typename (pstate->language (), pstate->gdbarch (),
|
||||
copy_name (yylval.sval),
|
||||
expression_context_block, 1))
|
||||
pstate->expression_context_block, 1))
|
||||
return TYPENAME;
|
||||
|
||||
if(sym)
|
||||
|
26
gdb/p-exp.y
26
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)
|
||||
|
12
gdb/parse.c
12
gdb/parse.c
@ -66,8 +66,6 @@ const struct exp_descriptor exp_descriptor_standard =
|
||||
};
|
||||
|
||||
/* Global variables declared in parser-defs.h (and commented there). */
|
||||
const struct block *expression_context_block;
|
||||
CORE_ADDR expression_context_pc;
|
||||
innermost_block_tracker innermost_block;
|
||||
int arglist_len;
|
||||
static struct type_stack type_stack;
|
||||
@ -593,7 +591,7 @@ mark_completion_tag (enum type_code tag, const char *ptr, int length)
|
||||
value in the value history, I.e. $$1 */
|
||||
|
||||
void
|
||||
write_dollar_variable (struct expr_builder *ps, struct stoken str)
|
||||
write_dollar_variable (struct parser_state *ps, struct stoken str)
|
||||
{
|
||||
struct block_symbol sym;
|
||||
struct bound_minimal_symbol msym;
|
||||
@ -683,7 +681,7 @@ handle_register:
|
||||
str.ptr++;
|
||||
write_exp_string (ps, str);
|
||||
write_exp_elt_opcode (ps, OP_REGISTER);
|
||||
innermost_block.update (expression_context_block,
|
||||
innermost_block.update (ps->expression_context_block,
|
||||
INNERMOST_BLOCK_FOR_REGISTERS);
|
||||
return;
|
||||
}
|
||||
@ -1135,7 +1133,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
||||
scoped_restore save_funcall_chain = make_scoped_restore (&funcall_chain,
|
||||
&funcalls);
|
||||
|
||||
expression_context_block = block;
|
||||
const struct block *expression_context_block = block;
|
||||
CORE_ADDR expression_context_pc = 0;
|
||||
|
||||
/* If no context specified, try using the current frame, if any. */
|
||||
if (!expression_context_block)
|
||||
@ -1189,7 +1188,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
|
||||
and others called from *.y) ensure CURRENT_LANGUAGE gets restored
|
||||
to the value matching SELECTED_FRAME as set by get_current_arch. */
|
||||
|
||||
parser_state ps (lang, get_current_arch ());
|
||||
parser_state ps (lang, get_current_arch (), expression_context_block,
|
||||
expression_context_pc);
|
||||
|
||||
scoped_restore_current_language lang_saver;
|
||||
set_language (lang->la_language);
|
||||
|
@ -86,25 +86,30 @@ 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. */
|
||||
|
||||
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. */
|
||||
const CORE_ADDR expression_context_pc;
|
||||
};
|
||||
|
||||
/* If this is nonzero, this block is used as the lexical context
|
||||
for symbol names. */
|
||||
|
||||
extern const struct block *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;
|
||||
|
||||
/* 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 *);
|
||||
|
||||
|
@ -1033,7 +1033,7 @@ rust_parser::concat3 (const char *s1, const char *s2, const char *s3)
|
||||
const struct rust_op *
|
||||
rust_parser::crate_name (const struct rust_op *name)
|
||||
{
|
||||
std::string crate = rust_crate_for_block (expression_context_block);
|
||||
std::string crate = rust_crate_for_block (pstate->expression_context_block);
|
||||
struct stoken result;
|
||||
|
||||
gdb_assert (name->opcode == OP_VAR_VALUE);
|
||||
@ -1053,7 +1053,7 @@ rust_parser::crate_name (const struct rust_op *name)
|
||||
const struct rust_op *
|
||||
rust_parser::super_name (const struct rust_op *ident, unsigned int n_supers)
|
||||
{
|
||||
const char *scope = block_scope (expression_context_block);
|
||||
const char *scope = block_scope (pstate->expression_context_block);
|
||||
int offset;
|
||||
|
||||
gdb_assert (ident->opcode == OP_VAR_VALUE);
|
||||
@ -2045,7 +2045,7 @@ rust_parser::convert_ast_to_type (const struct rust_op *operation)
|
||||
{
|
||||
const char *varname = convert_name (operation);
|
||||
|
||||
result = rust_lookup_type (varname, expression_context_block);
|
||||
result = rust_lookup_type (varname, pstate->expression_context_block);
|
||||
if (result == NULL)
|
||||
error (_("No typed name '%s' in current context"), varname);
|
||||
return result;
|
||||
@ -2118,7 +2118,7 @@ rust_parser::convert_ast_to_type (const struct rust_op *operation)
|
||||
|
||||
/* We don't allow creating new tuple types (yet), but we do
|
||||
allow looking up existing tuple types. */
|
||||
result = rust_lookup_type (name, expression_context_block);
|
||||
result = rust_lookup_type (name, pstate->expression_context_block);
|
||||
if (result == NULL)
|
||||
error (_("could not find tuple type '%s'"), name);
|
||||
}
|
||||
@ -2311,7 +2311,8 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
|
||||
struct type *type;
|
||||
const char *varname = convert_name (operation->left.op);
|
||||
|
||||
type = rust_lookup_type (varname, expression_context_block);
|
||||
type = rust_lookup_type (varname,
|
||||
pstate->expression_context_block);
|
||||
if (type != NULL)
|
||||
{
|
||||
/* This is actually a tuple struct expression, not a
|
||||
@ -2372,7 +2373,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
|
||||
}
|
||||
|
||||
varname = convert_name (operation);
|
||||
sym = rust_lookup_symbol (varname, expression_context_block,
|
||||
sym = rust_lookup_symbol (varname, pstate->expression_context_block,
|
||||
VAR_DOMAIN);
|
||||
if (sym.symbol != NULL && SYMBOL_CLASS (sym.symbol) != LOC_TYPEDEF)
|
||||
{
|
||||
@ -2391,7 +2392,8 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
|
||||
type = SYMBOL_TYPE (sym.symbol);
|
||||
}
|
||||
if (type == NULL)
|
||||
type = rust_lookup_type (varname, expression_context_block);
|
||||
type = rust_lookup_type (varname,
|
||||
pstate->expression_context_block);
|
||||
if (type == NULL)
|
||||
error (_("No symbol '%s' in current context"), varname);
|
||||
|
||||
@ -2449,7 +2451,7 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation,
|
||||
}
|
||||
|
||||
name = convert_name (operation->left.op);
|
||||
type = rust_lookup_type (name, expression_context_block);
|
||||
type = rust_lookup_type (name, pstate->expression_context_block);
|
||||
if (type == NULL)
|
||||
error (_("Could not find type '%s'"), operation->left.sval.ptr);
|
||||
|
||||
@ -2707,7 +2709,8 @@ rust_lex_tests (void)
|
||||
int i;
|
||||
|
||||
// Set up dummy "parser", so that rust_type works.
|
||||
struct parser_state ps (&rust_language_defn, target_gdbarch ());
|
||||
struct parser_state ps (&rust_language_defn, target_gdbarch (),
|
||||
nullptr, 0);
|
||||
rust_parser parser (&ps);
|
||||
|
||||
rust_lex_test_one (&parser, "", 0);
|
||||
|
Reference in New Issue
Block a user