]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: expand: Merge arguments into one
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 19 Jun 2023 12:01:13 +0000 (14:01 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:46:29 +0000 (18:46 +0100)
The second argument could be derived from the first one, the second
argument is hence useless as the first argument alone could be kept to
access it's data.

gcc/rust/ChangeLog:

* expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_stmts):
Remove second argument.
(ExpandVisitor::visit): Remove argument from function call.
* expand/rust-expand-visitor.h: Update function prototype.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/expand/rust-expand-visitor.cc
gcc/rust/expand/rust-expand-visitor.h

index d79aeac440b63d1f40e974c13716ed7ec88d4ad2..28ff3df314870193a1cfa940900cd1ef34ed2ddd 100644 (file)
@@ -286,9 +286,9 @@ ExpandVisitor::expand_inner_items (
 }
 
 void
-ExpandVisitor::expand_inner_stmts (
-  AST::BlockExpr &expr, std::vector<std::unique_ptr<AST::Stmt>> &stmts)
+ExpandVisitor::expand_inner_stmts (AST::BlockExpr &expr)
 {
+  auto &stmts = expr.get_statements ();
   expander.push_context (MacroExpander::ContextType::STMT);
 
   for (auto it = stmts.begin (); it != stmts.end (); it++)
@@ -834,7 +834,7 @@ ExpandVisitor::visit (AST::ClosureExprInner &expr)
 void
 ExpandVisitor::visit (AST::BlockExpr &expr)
 {
-  expand_inner_stmts (expr, expr.get_statements ());
+  expand_inner_stmts (expr);
 
   expand_tail_expr (expr, expander);
   if (expr.has_tail_expr ())
index e7e303b44b4f29f32ac9c5bf8d226c7284975ea3..a88c91e81f8e2398146fe86dac7f24bdade69bf1 100644 (file)
@@ -158,8 +158,7 @@ public:
    * @param values Vector of values to mutate in-place and append into
    */
   void expand_inner_items (std::vector<std::unique_ptr<AST::Item>> &values);
-  void expand_inner_stmts (AST::BlockExpr &expr,
-                          std::vector<std::unique_ptr<AST::Stmt>> &values);
+  void expand_inner_stmts (AST::BlockExpr &expr);
 
   // TODO: See if possible to make more specialization for Impl items, Block
   // stmts etc? This could allow us to remove expand_macro_children or at least