diff options
author | Tom Tromey <tromey@adacore.com> | 2022-02-22 09:48:25 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-04-04 12:46:09 -0600 |
commit | 1e237aba2216f89b9a4b3235ad8d09d1b1b8f039 (patch) | |
tree | 088adb7b45abf2f494d139e2a4865355d8cef3bf /gdb/expop.h | |
parent | 28c4b1ffaa41b17af11984c0383a8a37ea00eef4 (diff) | |
download | binutils-1e237aba2216f89b9a4b3235ad8d09d1b1b8f039.zip binutils-1e237aba2216f89b9a4b3235ad8d09d1b1b8f039.tar.gz binutils-1e237aba2216f89b9a4b3235ad8d09d1b1b8f039.tar.bz2 |
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.
Diffstat (limited to 'gdb/expop.h')
-rw-r--r-- | gdb/expop.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/gdb/expop.h b/gdb/expop.h index c8c1aa1..c159d96 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -997,18 +997,16 @@ public: return std::get<1> (m_storage); } - /* Used for completion. Evaluate the LHS for type. */ - value *evaluate_lhs (struct expression *exp) - { - return std::get<0> (m_storage)->evaluate (nullptr, exp, - EVAL_AVOID_SIDE_EFFECTS); - } - value *evaluate_funcall (struct type *expect_type, struct expression *exp, enum noside noside, const std::vector<operation_up> &args) override; + /* Try to complete this operation in the context of EXP. TRACKER is + the completion tracker to update. Return true if completion was + possible, false otherwise. */ + bool complete (struct expression *exp, completion_tracker &tracker); + protected: using tuple_holding_operation::tuple_holding_operation; |