From d6cb04bf5c0d77f60572f6f076fb602a8aeabf98 Mon Sep 17 00:00:00 2001 From: Abdul Rafey Date: Sun, 29 Jan 2023 16:59:17 +0530 Subject: 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 --- gcc/rust/ast/rust-ast.cc | 2 +- gcc/rust/ast/rust-expr.h | 2 +- gcc/rust/hir/tree/rust-hir-expr.h | 2 +- gcc/rust/operator.h | 72 --------------------------------------- gcc/rust/rust-backend.h | 2 +- gcc/rust/util/rust-lang-item.h | 2 +- gcc/rust/util/rust-operators.h | 72 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 77 deletions(-) delete mode 100644 gcc/rust/operator.h create mode 100644 gcc/rust/util/rust-operators.h (limited to 'gcc') diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc index 280f59f..60a9f01 100644 --- a/gcc/rust/ast/rust-ast.cc +++ b/gcc/rust/ast/rust-ast.cc @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "rust-session-manager.h" #include "rust-lex.h" #include "rust-parse.h" -#include "operator.h" +#include "rust-operators.h" /* Compilation unit used for various AST-related functions that would make * the headers too long if they were defined inline and don't receive any diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 34bc699..3ed1885d 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -3,7 +3,7 @@ #include "rust-ast.h" #include "rust-path.h" -#include "operator.h" +#include "rust-operators.h" namespace Rust { namespace AST { diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h index cc88442..bf10351 100644 --- a/gcc/rust/hir/tree/rust-hir-expr.h +++ b/gcc/rust/hir/tree/rust-hir-expr.h @@ -23,7 +23,7 @@ #include "rust-ast-full-decls.h" #include "rust-hir.h" #include "rust-hir-path.h" -#include "operator.h" +#include "rust-operators.h" namespace Rust { namespace HIR { diff --git a/gcc/rust/operator.h b/gcc/rust/operator.h deleted file mode 100644 index dab44e9..0000000 --- a/gcc/rust/operator.h +++ /dev/null @@ -1,72 +0,0 @@ -// 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 -// . - -#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 diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index 01c5fc4..076104f 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -26,7 +26,7 @@ #include "rust-location.h" #include "rust-linemap.h" #include "rust-diagnostics.h" -#include "operator.h" +#include "util/rust-operators.h" #include "tree.h" // Pointers to these types are created by the backend, passed to the diff --git a/gcc/rust/util/rust-lang-item.h b/gcc/rust/util/rust-lang-item.h index ea0c91a..29c364b 100644 --- a/gcc/rust/util/rust-lang-item.h +++ b/gcc/rust/util/rust-lang-item.h @@ -17,7 +17,7 @@ // . #include "rust-system.h" -#include "operator.h" +#include "rust-operators.h" namespace Rust { namespace Analysis { 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 +// . + +#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 -- cgit v1.1