From 57d12c683b3783e2b9460fe5607a4d91f6b67de9 Mon Sep 17 00:00:00 2001 From: Antonio Gomes Date: Sun, 14 Jul 2024 01:45:24 -0300 Subject: gccrs: Improve error messages for operator expressions gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Add new get_operator_str method in ArithmeticOrLogicalExpr and CompoundAssignmentExpr * hir/tree/rust-hir.cc: Likewise * typecheck/rust-hir-type-check-expr.cc: Improve error message for operator expressions to display the correct operator symbol gcc/testsuite/ChangeLog: * rust/compile/shadow1.rs: Fix test for new error message Signed-off-by: Antonio Gomes --- gcc/rust/hir/tree/rust-hir-expr.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/rust/hir/tree/rust-hir-expr.h') diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index d8cfe68..ff9fcee 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -417,6 +417,8 @@ public: std::unique_ptr &get_lhs () { return main_or_left_expr; } std::unique_ptr &get_rhs () { return right_expr; } + std::string get_operator_str () const; + protected: /* Use covariance to implement clone function as returning this object rather * than base */ @@ -766,6 +768,8 @@ public: void visit_lhs (HIRFullVisitor &vis) { main_or_left_expr->accept_vis (vis); } void visit_rhs (HIRFullVisitor &vis) { right_expr->accept_vis (vis); } + std::string get_operator_str () const; + protected: /* Use covariance to implement clone function as returning this object rather * than base */ -- cgit v1.1