From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 8CAF3383F944; Wed, 8 Jun 2022 10:39:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8CAF3383F944 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Fix formatting X-Act-Checkin: gcc X-Git-Author: Yizhe X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 4ebeb3165cfdaa1b95ed39779760b634974a80e5 X-Git-Newrev: 6f1035737677dbe38dc6f25f24744fd209d0209c Message-Id: <20220608103916.8CAF3383F944@sourceware.org> Date: Wed, 8 Jun 2022 10:39:16 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2022 10:39:16 -0000 https://gcc.gnu.org/g:6f1035737677dbe38dc6f25f24744fd209d0209c commit 6f1035737677dbe38dc6f25f24744fd209d0209c Author: Yizhe Date: Fri Feb 26 09:14:16 2021 +0000 Fix formatting Diff: --- gcc/rust/hir/rust-ast-lower-expr.h | 19 +++++++++------- gcc/rust/hir/tree/rust-hir-full-test.cc | 40 ++++++++++++++++----------------- gcc/rust/parse/rust-parse-impl.h | 34 +++++++++++++++------------- gcc/rust/rust-backend.h | 4 ++-- gcc/rust/rust-gcc.cc | 7 +++--- 5 files changed, 54 insertions(+), 50 deletions(-) diff --git a/gcc/rust/hir/rust-ast-lower-expr.h b/gcc/rust/hir/rust-ast-lower-expr.h index 6247be09302..7d193709f1a 100644 --- a/gcc/rust/hir/rust-ast-lower-expr.h +++ b/gcc/rust/hir/rust-ast-lower-expr.h @@ -402,7 +402,8 @@ public: = new HIR::ArithmeticOrLogicalExpr (mapping, std::unique_ptr (lhs), std::unique_ptr (rhs), - expr.get_expr_type(), expr.get_locus ()); + expr.get_expr_type (), + expr.get_locus ()); } void visit (AST::ComparisonExpr &expr) @@ -419,8 +420,8 @@ public: translated = new HIR::ComparisonExpr (mapping, std::unique_ptr (lhs), - std::unique_ptr (rhs), expr.get_expr_type(), - expr.get_locus ()); + std::unique_ptr (rhs), + expr.get_expr_type (), expr.get_locus ()); } void visit (AST::LazyBooleanExpr &expr) @@ -437,8 +438,8 @@ public: translated = new HIR::LazyBooleanExpr (mapping, std::unique_ptr (lhs), - std::unique_ptr (rhs), expr.get_expr_type(), - expr.get_locus ()); + std::unique_ptr (rhs), + expr.get_expr_type (), expr.get_locus ()); } void visit (AST::NegationExpr &expr) @@ -454,14 +455,16 @@ public: UNKNOWN_LOCAL_DEFID); translated = new HIR::NegationExpr (mapping, - std::unique_ptr (negated_value), expr.get_expr_type(), - std::move (outer_attribs), expr.get_locus ()); + std::unique_ptr (negated_value), + expr.get_expr_type (), std::move (outer_attribs), + expr.get_locus ()); } /* Compound assignment expression is compiled away. */ void visit (AST::CompoundAssignmentExpr &expr) { - /* First we need to find the corresponding arithmetic or logical operator. */ + /* First we need to find the corresponding arithmetic or logical operator. + */ ArithmeticOrLogicalOperator op; switch (expr.get_expr_type ()) { diff --git a/gcc/rust/hir/tree/rust-hir-full-test.cc b/gcc/rust/hir/tree/rust-hir-full-test.cc index 3ced5370be0..fb5f665d436 100644 --- a/gcc/rust/hir/tree/rust-hir-full-test.cc +++ b/gcc/rust/hir/tree/rust-hir-full-test.cc @@ -1687,10 +1687,10 @@ NegationExpr::as_string () const switch (expr_type) { - case NegationOperator::NEGATE: + case NegationOperator::NEGATE: str = "-"; break; - case NegationOperator::NOT: + case NegationOperator::NOT: str = "!"; break; default: @@ -1748,22 +1748,22 @@ ComparisonExpr::as_string () const switch (expr_type) { - case ComparisonOperator::EQUAL: + case ComparisonOperator::EQUAL: str += " == "; break; - case ComparisonOperator::NOT_EQUAL: + case ComparisonOperator::NOT_EQUAL: str += " != "; break; - case ComparisonOperator::GREATER_THAN: + case ComparisonOperator::GREATER_THAN: str += " > "; break; - case ComparisonOperator::LESS_THAN: + case ComparisonOperator::LESS_THAN: str += " < "; break; - case ComparisonOperator::GREATER_OR_EQUAL: + case ComparisonOperator::GREATER_OR_EQUAL: str += " >= "; break; - case ComparisonOperator::LESS_OR_EQUAL: + case ComparisonOperator::LESS_OR_EQUAL: str += " <= "; break; default: @@ -1832,10 +1832,10 @@ LazyBooleanExpr::as_string () const switch (expr_type) { - case LazyBooleanOperator::LOGICAL_OR: + case LazyBooleanOperator::LOGICAL_OR: str += " || "; break; - case LazyBooleanOperator::LOGICAL_AND: + case LazyBooleanOperator::LOGICAL_AND: str += " && "; break; default: @@ -2000,34 +2000,34 @@ ArithmeticOrLogicalExpr::as_string () const // get operator string switch (expr_type) { - case ArithmeticOrLogicalOperator::ADD: + case ArithmeticOrLogicalOperator::ADD: operator_str = "+"; break; - case ArithmeticOrLogicalOperator::SUBTRACT: + case ArithmeticOrLogicalOperator::SUBTRACT: operator_str = "-"; break; - case ArithmeticOrLogicalOperator::MULTIPLY: + case ArithmeticOrLogicalOperator::MULTIPLY: operator_str = "*"; break; - case ArithmeticOrLogicalOperator::DIVIDE: + case ArithmeticOrLogicalOperator::DIVIDE: operator_str = "/"; break; - case ArithmeticOrLogicalOperator::MODULUS: + case ArithmeticOrLogicalOperator::MODULUS: operator_str = "%"; break; - case ArithmeticOrLogicalOperator::BITWISE_AND: + case ArithmeticOrLogicalOperator::BITWISE_AND: operator_str = "&"; break; - case ArithmeticOrLogicalOperator::BITWISE_OR: + case ArithmeticOrLogicalOperator::BITWISE_OR: operator_str = "|"; break; - case ArithmeticOrLogicalOperator::BITWISE_XOR: + case ArithmeticOrLogicalOperator::BITWISE_XOR: operator_str = "^"; break; - case ArithmeticOrLogicalOperator::LEFT_SHIFT: + case ArithmeticOrLogicalOperator::LEFT_SHIFT: operator_str = "<<"; break; - case ArithmeticOrLogicalOperator::RIGHT_SHIFT: + case ArithmeticOrLogicalOperator::RIGHT_SHIFT: operator_str = ">>"; break; default: diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 012564936c6..5cbd8a56b65 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -12528,9 +12528,10 @@ Parser::left_denotation ( // sum expression - binary infix /*return parse_binary_plus_expr (tok, std::move (left), std::move (outer_attrs), restrictions);*/ - return parse_arithmetic_or_logical_expr ( - tok, std::move (left), std::move (outer_attrs), - ArithmeticOrLogicalOperator::ADD, restrictions); + return parse_arithmetic_or_logical_expr (tok, std::move (left), + std::move (outer_attrs), + ArithmeticOrLogicalOperator::ADD, + restrictions); case MINUS: // difference expression - binary infix /*return parse_binary_minus_expr (tok, std::move (left), @@ -12600,8 +12601,7 @@ Parser::left_denotation ( std::move (outer_attrs), restrictions);*/ return parse_comparison_expr (tok, std::move (left), std::move (outer_attrs), - ComparisonOperator::EQUAL, - restrictions); + ComparisonOperator::EQUAL, restrictions); case NOT_EQUAL: // not equal to expression - binary infix (no associativity) /*return parse_binary_not_equal_expr (tok, std::move (left), @@ -12634,17 +12634,19 @@ Parser::left_denotation ( /*return parse_binary_greater_equal_expr (tok, std::move (left), std::move (outer_attrs), restrictions);*/ - return parse_comparison_expr ( - tok, std::move (left), std::move (outer_attrs), - ComparisonOperator::GREATER_OR_EQUAL, restrictions); + return parse_comparison_expr (tok, std::move (left), + std::move (outer_attrs), + ComparisonOperator::GREATER_OR_EQUAL, + restrictions); case LESS_OR_EQUAL: // less than or equal to expression - binary infix (no associativity) /*return parse_binary_less_equal_expr (tok, std::move (left), std::move (outer_attrs), restrictions);*/ - return parse_comparison_expr ( - tok, std::move (left), std::move (outer_attrs), - ComparisonOperator::LESS_OR_EQUAL, restrictions); + return parse_comparison_expr (tok, std::move (left), + std::move (outer_attrs), + ComparisonOperator::LESS_OR_EQUAL, + restrictions); case OR: // lazy logical or expression - binary infix return parse_lazy_or_expr (tok, std::move (left), std::move (outer_attrs), @@ -12692,9 +12694,10 @@ Parser::left_denotation ( * associativity) */ /*return parse_div_assig_expr (tok, std::move (left), std::move (outer_attrs), restrictions);*/ - return parse_compound_assignment_expr ( - tok, std::move (left), std::move (outer_attrs), - CompoundAssignmentOperator::DIVIDE, restrictions); + return parse_compound_assignment_expr (tok, std::move (left), + std::move (outer_attrs), + CompoundAssignmentOperator::DIVIDE, + restrictions); case PERCENT_EQ: /* modulo-assignment expression - binary infix (note right-to-left * associativity) */ @@ -12901,8 +12904,7 @@ Parser::parse_binary_plus_expr ( return std::unique_ptr ( new AST::ArithmeticOrLogicalExpr (std::move (left), std::move (right), - ArithmeticOrLogicalOperator::ADD, - locus)); + ArithmeticOrLogicalOperator::ADD, locus)); } // Parses a binary subtraction expression (with Pratt parsing). diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index cca341dfa81..183f41a3aa7 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -379,8 +379,8 @@ public: // Return an expression for the operation LEFT OP RIGHT. // Supported values of OP are enumerated in ComparisonOperator. virtual Bexpression *comparison_expression (ComparisonOperator op, - Bexpression *left, - Bexpression *right, Location) + Bexpression *left, + Bexpression *right, Location) = 0; // Return an expression for the operation LEFT OP RIGHT. diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index a19ddae193d..f8033af35f3 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -300,9 +300,8 @@ public: Bexpression *left, Bexpression *right, Location); - Bexpression *comparison_expression (ComparisonOperator op, - Bexpression *left, Bexpression *right, - Location); + Bexpression *comparison_expression (ComparisonOperator op, Bexpression *left, + Bexpression *right, Location); Bexpression *lazy_boolean_expression (LazyBooleanOperator op, Bexpression *left, Bexpression *right, @@ -1812,7 +1811,7 @@ Gcc_backend::arithmetic_or_logical_expression (ArithmeticOrLogicalOperator op, // Return an expression for the comparison operation LEFT OP RIGHT. Bexpression * Gcc_backend::comparison_expression (ComparisonOperator op, Bexpression *left, - Bexpression *right, Location location) + Bexpression *right, Location location) { /* Check if either expression is an error, in which case we return an error expression. */