From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 04/11] Simplify parser_state constructor
Date: Thu, 04 May 2023 08:21:25 -0600 [thread overview]
Message-ID: <20230504-frameless-v1-4-4191201740b0@adacore.com> (raw)
In-Reply-To: <20230504-frameless-v1-0-4191201740b0@adacore.com>
This simplifies the parser_state constructor by having it accept a
parser_flags parameter.
---
gdb/parse.c | 7 ++-----
gdb/parser-defs.h | 9 ++++-----
gdb/rust-parse.c | 2 +-
3 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/gdb/parse.c b/gdb/parse.c
index ed0d0b8a880..2f014dd2172 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -398,11 +398,8 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
to the value matching SELECTED_FRAME as set by get_current_arch. */
parser_state ps (lang, get_current_arch (), expression_context_block,
- expression_context_pc,
- (flags & PARSER_COMMA_TERMINATES) != 0,
- *stringptr,
- completer != nullptr, tracker,
- (flags & PARSER_VOID_CONTEXT) != 0);
+ expression_context_pc, flags, *stringptr,
+ completer != nullptr, tracker);
scoped_restore_current_language lang_saver;
set_language (lang->la_language);
diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h
index 5c6bc222b6b..2a246ff38f0 100644
--- a/gdb/parser-defs.h
+++ b/gdb/parser-defs.h
@@ -146,19 +146,18 @@ struct parser_state : public expr_builder
struct gdbarch *gdbarch,
const struct block *context_block,
CORE_ADDR context_pc,
- int comma,
+ parser_flags flags,
const char *input,
bool completion,
- innermost_block_tracker *tracker,
- bool void_p)
+ innermost_block_tracker *tracker)
: expr_builder (lang, gdbarch),
expression_context_block (context_block),
expression_context_pc (context_pc),
- comma_terminates (comma),
+ comma_terminates ((flags & PARSER_COMMA_TERMINATES) != 0),
lexptr (input),
parse_completion (completion),
block_tracker (tracker),
- void_context_p (void_p)
+ void_context_p ((flags & PARSER_VOID_CONTEXT) != 0)
{
}
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index 648e48dda40..6ba959065c9 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -2300,7 +2300,7 @@ rust_lex_tests (void)
{
/* Set up dummy "parser", so that rust_type works. */
struct parser_state ps (language_def (language_rust), target_gdbarch (),
- nullptr, 0, 0, nullptr, 0, nullptr, false);
+ nullptr, 0, 0, nullptr, 0, nullptr);
rust_parser parser (&ps);
rust_lex_test_one (&parser, "", 0);
--
2.39.1
next prev parent reply other threads:[~2023-05-04 14:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-04 14:21 [PATCH 00/11] Fix frame-less expression evaluation in DAP Tom Tromey
2023-05-04 14:21 ` [PATCH 01/11] Avoid forward declaration in parse.c Tom Tromey
2023-05-04 14:21 ` [PATCH 02/11] Move innermost_block_tracker to expression.h Tom Tromey
2023-05-04 14:21 ` [PATCH 03/11] Introduce and use parser flags Tom Tromey
2023-05-04 14:21 ` Tom Tromey [this message]
2023-05-04 14:21 ` [PATCH 05/11] Boolify parser_state::comma_terminates Tom Tromey
2023-05-04 14:21 ` [PATCH 06/11] Rearrange parser_state Tom Tromey
2023-05-04 14:21 ` [PATCH 07/11] Add PARSER_DEBUG flag Tom Tromey
2023-05-04 14:21 ` [PATCH 08/11] Add PARSER_LEAVE_BLOCK_ALONE flag Tom Tromey
2023-05-04 14:21 ` [PATCH 09/11] Add flags to parse_and_eval Tom Tromey
2023-05-04 14:21 ` [PATCH 10/11] Add global_context parameter to gdb.parse_and_eval Tom Tromey
2023-05-04 14:54 ` Eli Zaretskii
2023-05-23 20:17 ` Tom Tromey
2023-05-04 14:21 ` [PATCH 11/11] Handle DAP evaluate request without a frame ID Tom Tromey
2023-05-23 20:17 ` [PATCH 00/11] Fix frame-less expression evaluation in DAP Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230504-frameless-v1-4-4191201740b0@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).