aboutsummaryrefslogtreecommitdiff
path: root/gdb/rust-exp.h
AgeCommit message (Collapse)AuthorFilesLines
2022-02-06Fix Rust parser bug with function fieldsTom Tromey1-0/+27
In Rust, 'obj.f()' is a method call -- but '(obj.f)()' is a call of a function-valued field 'f' in 'obj'. The Rust parser in gdb currently gets this wrong. This is PR rust/24082. The expression and Rust parser rewrites made this simple to fix -- simply wrapping a parenthesized expression in a new operation handles it. This patch has a slight hack because I didn't want to introduce a new exp_opcode enumeration constant just for this. IMO this doesn't matter, since we should work toward removing dependencies on these opcodes anyway; but let me know what you think of this. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=24082
2022-01-23Simplify some Rust expression-evaluation codeTom Tromey1-36/+3
A few Rust operations do a bit of work in their 'evaluate' functions and then call another function -- but are also the only caller. This patch simplifies this code by removing the extra layer. Tested on x86-64 Fedora 34. I'm checking this in.
2022-01-01Automatic Copyright Year update after running gdb/copyright.pyJoel Brobecker1-1/+1
This commit brings all the changes made by running gdb/copyright.py as per GDB's Start of New Year Procedure. For the avoidance of doubt, all changes in this commits were performed by the script.
2021-03-08Implement Rust funcall operationTom Tromey1-0/+5
This adds the special code needed to handle the Rust function call operation. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_structop::evaluate_funcall): New method. * rust-exp.h (class rust_structop) <evaluate_funcall>: Declare method.
2021-03-08Introduce rust_aggregate_operationTom Tromey1-0/+18
This adds class rust_aggregate_operation, which implements OP_AGGREGATE for Rust. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_aggregate_operation::evaluate): New method. * rust-exp.h (class rust_aggregate_operation): New.
2021-03-08Implement Rust field operationsTom Tromey1-0/+53
This implements the field operations STRUCTOP_STRUCT and STRUCTOP_ANONYMOUS, for Rust. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (eval_op_rust_struct_anon, eval_op_rust_structop): No longer static. * rust-exp.h (class rust_struct_anon): New. (class rust_structop): New.
2021-03-08Introduce rust_range_operationTom Tromey1-0/+30
This adds class rust_range_operation, which implements OP_RANGE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_range): No longer static. * rust-exp.h (class rust_range_operation): New.
2021-03-08Introduce rust_subscript_operationTom Tromey1-0/+57
This adds class rust_subscript_operation, which implements BINOP_SUBSCRIPT for Rust. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_subscript): No longer static. * rust-exp.h (class rust_subscript_operation): New.
2021-03-08Introduce rust_unop_ind_operationTom Tromey1-0/+25
This adds class rust_unop_ind_operation, which implements UNOP_IND for Rust. Rust requires a special case here to handle trait objects. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (eval_op_rust_ind): No longer static. Add "opcode" parameter. (rust_evaluate_subexp): Update. * rust-exp.h (class rust_unop_ind_operation): New.
2021-03-08Implement some Rust operationsTom Tromey1-0/+47
This implements some straightforward Rust operations, using existing template classes. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * rust-lang.c (eval_op_rust_complement, eval_op_rust_array): No longer static. Add "opcode" parameter. (rust_evaluate_subexp): Update. * rust-exp.h: New file.