From fa9f5be6830e9245ee1ad1eab9725cc039d45d07 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 24 Mar 2019 08:56:33 -0600 Subject: Turn parse_gdbarch into a method This changes parse_gdbarch into a method of parser_state. This patch was written by a script. gdb/ChangeLog 2019-04-04 Tom Tromey * rust-exp.y: Replace "parse_gdbarch" with method call. * parse.c (write_dollar_variable, insert_type_address_space): Replace "parse_gdbarch" with method call. * p-exp.y (parse_type, yylex): Replace "parse_gdbarch" with method call. * objc-lang.c (end_msglist): Replace "parse_gdbarch" with method call. * m2-exp.y (parse_type, parse_m2_type, yylex): Replace "parse_gdbarch" with method call. * go-exp.y (parse_type, classify_name): Replace "parse_gdbarch" with method call. * f-exp.y (parse_type, parse_f_type, yylex): Replace "parse_gdbarch" with method call. * d-exp.y (parse_type, parse_d_type, lex_one_token): Replace "parse_gdbarch" with method call. * c-exp.y (parse_type, parse_number, classify_name): Replace "parse_gdbarch" with method call. * ada-lex.l: Replace "parse_gdbarch" with method call. * ada-exp.y (parse_type, find_primitive_type, type_char) (type_system_address): Replace "parse_gdbarch" with method call. --- gdb/p-exp.y | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'gdb/p-exp.y') diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 31e8c4b..d4b3150 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -56,7 +56,7 @@ #include "block.h" #include "completer.h" -#define parse_type(ps) builtin_type (parse_gdbarch (ps)) +#define parse_type(ps) builtin_type (ps->gdbarch ()) /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc). */ @@ -528,7 +528,7 @@ exp : DOLLAR_VARIABLE struct value * val, * mark; mark = value_mark (); - val = value_of_internalvar (parse_gdbarch (pstate), + val = value_of_internalvar (pstate->gdbarch (), intvar); current_type = value_type (val); value_release_to_mark (mark); @@ -973,10 +973,10 @@ parse_number (struct parser_state *par_state, un = (ULONGEST)n >> 2; if (long_p == 0 - && (un >> (gdbarch_int_bit (parse_gdbarch (par_state)) - 2)) == 0) + && (un >> (gdbarch_int_bit (par_state->gdbarch ()) - 2)) == 0) { high_bit - = ((ULONGEST)1) << (gdbarch_int_bit (parse_gdbarch (par_state)) - 1); + = ((ULONGEST)1) << (gdbarch_int_bit (par_state->gdbarch ()) - 1); /* A large decimal (not hex or octal) constant (between INT_MAX and UINT_MAX) is a long or unsigned long, according to ANSI, @@ -988,10 +988,10 @@ parse_number (struct parser_state *par_state, signed_type = parse_type (par_state)->builtin_int; } else if (long_p <= 1 - && (un >> (gdbarch_long_bit (parse_gdbarch (par_state)) - 2)) == 0) + && (un >> (gdbarch_long_bit (par_state->gdbarch ()) - 2)) == 0) { high_bit - = ((ULONGEST)1) << (gdbarch_long_bit (parse_gdbarch (par_state)) - 1); + = ((ULONGEST)1) << (gdbarch_long_bit (par_state->gdbarch ()) - 1); unsigned_type = parse_type (par_state)->builtin_unsigned_long; signed_type = parse_type (par_state)->builtin_long; } @@ -999,11 +999,11 @@ parse_number (struct parser_state *par_state, { int shift; if (sizeof (ULONGEST) * HOST_CHAR_BIT - < gdbarch_long_long_bit (parse_gdbarch (par_state))) + < gdbarch_long_long_bit (par_state->gdbarch ())) /* A long long does not fit in a LONGEST. */ shift = (sizeof (ULONGEST) * HOST_CHAR_BIT - 1); else - shift = (gdbarch_long_long_bit (parse_gdbarch (par_state)) - 1); + shift = (gdbarch_long_long_bit (par_state->gdbarch ()) - 1); high_bit = (ULONGEST) 1 << shift; unsigned_type = parse_type (par_state)->builtin_unsigned_long_long; signed_type = parse_type (par_state)->builtin_long_long; @@ -1173,7 +1173,7 @@ yylex (void) lexptr++; c = *lexptr++; if (c == '\\') - c = parse_escape (parse_gdbarch (pstate), &lexptr); + c = parse_escape (pstate->gdbarch (), &lexptr); else if (c == '\'') error (_("Empty character constant.")); @@ -1343,7 +1343,7 @@ yylex (void) break; case '\\': ++tokptr; - c = parse_escape (parse_gdbarch (pstate), &tokptr); + c = parse_escape (pstate->gdbarch (), &tokptr); if (c == -1) { continue; @@ -1676,7 +1676,7 @@ yylex (void) } yylval.tsym.type = language_lookup_primitive_type (parse_language (pstate), - parse_gdbarch (pstate), tmp); + pstate->gdbarch (), tmp); if (yylval.tsym.type != NULL) { free (uptokstart); -- cgit v1.1