diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-11-15 18:13:32 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-11-16 15:09:53 +0000 |
commit | 04a49acfa3caa7a85a1a9edd24d69da0ad575ad5 (patch) | |
tree | d6bf4186cb815ff8b0bdf691c9659cf14bca8efd /gcc/rust/backend/rust-compile-expr.h | |
parent | 0f74fe23c6d602c257ba94b2522bd9d6a594609e (diff) | |
download | gcc-04a49acfa3caa7a85a1a9edd24d69da0ad575ad5.zip gcc-04a49acfa3caa7a85a1a9edd24d69da0ad575ad5.tar.gz gcc-04a49acfa3caa7a85a1a9edd24d69da0ad575ad5.tar.bz2 |
Add negation operator overload support
Unary operator expressions can be treated as simply having a nullptr
rvalue. This patch updates the shared operator overloading code to allow
for a nullptr rhs to canonicalize the code path for all operator overloads.
Fixes #249
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index 7238d45..b4079f7 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -474,15 +474,7 @@ public: = ctx->get_backend ()->lazy_boolean_expression (op, lhs, rhs, location); } - void visit (HIR::NegationExpr &expr) override - { - auto op = expr.get_expr_type (); - auto negated_expr = CompileExpr::Compile (expr.get_expr ().get (), ctx); - auto location = expr.get_locus (); - - translated - = ctx->get_backend ()->negation_expression (op, negated_expr, location); - } + void visit (HIR::NegationExpr &expr) override; void visit (HIR::TypeCastExpr &expr) override { |