aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-operators.h
diff options
context:
space:
mode:
authorAbdul Rafey <abdulrafeyq@gmail.com>2023-01-29 16:59:17 +0530
committerArthur Cohen <arthur.cohen@embecosm.com>2023-04-06 10:47:18 +0200
commitd6cb04bf5c0d77f60572f6f076fb602a8aeabf98 (patch)
tree99bcead79b99c3b8ba6ccf5996084d7b8bfe1fe7 /gcc/rust/util/rust-operators.h
parent9b19e93873c6145c9a0cdf631d9d1b8eece90d4e (diff)
downloadgcc-d6cb04bf5c0d77f60572f6f076fb602a8aeabf98.zip
gcc-d6cb04bf5c0d77f60572f6f076fb602a8aeabf98.tar.gz
gcc-d6cb04bf5c0d77f60572f6f076fb602a8aeabf98.tar.bz2
gccrs: moved operator.h to util/rust-operators.h
gcc/rust/ChangeLog: * ast/rust-ast.cc: Fix include list. * ast/rust-expr.h: Likewise. * hir/tree/rust-hir-expr.h: Likewise. * rust-backend.h: Likewise. * util/rust-lang-item.h: Likewise. * operator.h: Moved to... * util/rust-operators.h: ...here. Signed-off-by: Abdul Rafey <abdulrafeyq@gmail.com>
Diffstat (limited to 'gcc/rust/util/rust-operators.h')
-rw-r--r--gcc/rust/util/rust-operators.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-operators.h b/gcc/rust/util/rust-operators.h
new file mode 100644
index 0000000..dab44e9
--- /dev/null
+++ b/gcc/rust/util/rust-operators.h
@@ -0,0 +1,72 @@
+// Copyright (C) 2020-2023 Free Software Foundation, Inc.
+
+// This file is part of GCC.
+
+// GCC is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3, or (at your option) any later
+// version.
+
+// GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#ifndef RUST_OPERATOR_H
+#define RUST_OPERATOR_H
+
+enum class NegationOperator
+{
+ NEGATE,
+ NOT
+};
+
+enum class ArithmeticOrLogicalOperator
+{
+ ADD, // std::ops::Add
+ SUBTRACT, // std::ops::Sub
+ MULTIPLY, // std::ops::Mul
+ DIVIDE, // std::ops::Div
+ MODULUS, // std::ops::Rem
+ BITWISE_AND, // std::ops::BitAnd
+ BITWISE_OR, // std::ops::BitOr
+ BITWISE_XOR, // std::ops::BitXor
+ LEFT_SHIFT, // std::ops::Shl
+ RIGHT_SHIFT // std::ops::Shr
+};
+
+enum class ComparisonOperator
+{
+ EQUAL, // std::cmp::PartialEq::eq
+ NOT_EQUAL, // std::cmp::PartialEq::ne
+ GREATER_THAN, // std::cmp::PartialEq::gt
+ LESS_THAN, // std::cmp::PartialEq::lt
+ GREATER_OR_EQUAL, // std::cmp::PartialEq::ge
+ LESS_OR_EQUAL // std::cmp::PartialEq::le
+};
+
+enum class LazyBooleanOperator
+{
+ LOGICAL_OR,
+ LOGICAL_AND
+};
+
+enum class CompoundAssignmentOperator
+{
+ ADD, // std::ops::AddAssign
+ SUBTRACT, // std::ops::SubAssign
+ MULTIPLY, // std::ops::MulAssign
+ DIVIDE, // std::ops::DivAssign
+ MODULUS, // std::ops::RemAssign
+ BITWISE_AND, // std::ops::BitAndAssign
+ BITWISE_OR, // std::ops::BitOrAssign
+ BITWISE_XOR, // std::ops::BitXorAssign
+ LEFT_SHIFT, // std::ops::ShlAssign
+ RIGHT_SHIFT // std::ops::ShrAssign
+};
+
+#endif // RUST_OPERATOR_H