]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/completer.c
Refactor expression completion
authorTom Tromey <tromey@adacore.com>
Tue, 22 Feb 2022 16:48:25 +0000 (09:48 -0700)
committerTom Tromey <tromey@adacore.com>
Mon, 4 Apr 2022 18:46:09 +0000 (12:46 -0600)
commit1e237aba2216f89b9a4b3235ad8d09d1b1b8f039
tree088adb7b45abf2f494d139e2a4865355d8cef3bf
parent28c4b1ffaa41b17af11984c0383a8a37ea00eef4
Refactor expression completion

This refactors the gdb expression completion code to make it easier to
add more types of completers.

In the old approach, just two kinds of completers were supported:
field names for some sub-expression, or tag names (like "enum
something").  The data for each kind was combined in single structure,
"expr_completion_state", and handled explicitly by
complete_expression.

In the new approach, the parser state just holds an object that is
responsible for implementing completion.  This way, new completion
types can be added by subclassing this base object.

The structop completer is moved into structop_base_operation, and new
objects are defined for use by the completion code.  This moves much
of the logic of expression completion out of completer.c as well.
gdb/completer.c
gdb/eval.c
gdb/expop.h
gdb/expression.h
gdb/parse.c
gdb/parser-defs.h