]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Remove unused Context parameter for some backend methods
authorOwen Avery <powerboat9.gamer@gmail.com>
Thu, 25 Apr 2024 16:19:51 +0000 (12:19 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Mar 2025 15:35:22 +0000 (16:35 +0100)
gcc/rust/ChangeLog:

* backend/rust-compile-base.cc
(HIRCompileBase::compile_function_body):
Adjust unit_expression calls.
(HIRCompileBase::unit_expression):
Remove unused Context parameter.
* backend/rust-compile-base.h
(HIRCompileBase::unit_expression): Likewise.
* backend/rust-compile-block.cc
(CompileBlock::visit): Adjust unit_expression calls.
* backend/rust-compile-expr.cc
(CompileExpr::visit): Likewise.
* backend/rust-compile-pattern.cc
(CompilePatternLet::visit): Likewise.
* backend/rust-compile-resolve-path.cc
(ResolvePathRef::attempt_constructor_expression_lookup):
Likewise.
* backend/rust-compile-type.cc
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.
(TyTyResolveCompile::visit):
Adjust get_implicit_enumeral_node_type and get_unit_type calls.
* backend/rust-compile-type.h
(TyTyResolveCompile::get_implicit_enumeral_node_type):
Remove unused Context parameter.
(TyTyResolveCompile::get_unit_type):
Likewise.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/backend/rust-compile-base.cc
gcc/rust/backend/rust-compile-base.h
gcc/rust/backend/rust-compile-block.cc
gcc/rust/backend/rust-compile-expr.cc
gcc/rust/backend/rust-compile-pattern.cc
gcc/rust/backend/rust-compile-resolve-path.cc
gcc/rust/backend/rust-compile-type.cc
gcc/rust/backend/rust-compile-type.h

index e3138205a5ba8ab2d9fb22cd98ce2c6ee3c9f5db..64ac121a28f91b7d33e32c59eb291224b5f350ca 100644 (file)
@@ -611,7 +611,7 @@ HIRCompileBase::compile_function_body (tree fndecl,
          ctx->add_statement (return_value);
 
          // now just return unit expression
-         tree unit_expr = unit_expression (ctx, locus);
+         tree unit_expr = unit_expression (locus);
          tree return_stmt
            = Backend::return_statement (fndecl, unit_expr, locus);
          ctx->add_statement (return_stmt);
@@ -622,7 +622,7 @@ HIRCompileBase::compile_function_body (tree fndecl,
       // we can only do this if the function is of unit type otherwise other
       // errors should have occurred
       location_t locus = function_body.get_locus ();
-      tree return_value = unit_expression (ctx, locus);
+      tree return_value = unit_expression (locus);
       tree return_stmt
        = Backend::return_statement (fndecl, return_value, locus);
       ctx->add_statement (return_stmt);
@@ -991,9 +991,9 @@ HIRCompileBase::resolve_method_address (TyTy::FnType *fntype,
 }
 
 tree
-HIRCompileBase::unit_expression (Context *ctx, location_t locus)
+HIRCompileBase::unit_expression (location_t locus)
 {
-  tree unit_type = TyTyResolveCompile::get_unit_type (ctx);
+  tree unit_type = TyTyResolveCompile::get_unit_type ();
   return Backend::constructor_expression (unit_type, false, {}, -1, locus);
 }
 
index 316638a4a6b66a01924b29d6ed195a37307cf2d2..465a4caa720885e56c90075f472cfd811c2a45d3 100644 (file)
@@ -102,7 +102,7 @@ protected:
                         const Resolver::CanonicalPath *canonical_path,
                         TyTy::FnType *fntype);
 
-  static tree unit_expression (Context *ctx, location_t locus);
+  static tree unit_expression (location_t locus);
 
   void setup_fndecl (tree fndecl, bool is_main_entry_point, bool is_generic_fn,
                     HIR::Visibility &visibility,
index b36a15fd2fd1bc009028d8ed02955697a864a298..eb8af2a0d3be2c00809b1455496d724cdcdd0d4d 100644 (file)
@@ -75,7 +75,7 @@ CompileBlock::visit (HIR::BlockExpr &expr)
   else if (result != nullptr)
     {
       location_t locus = expr.get_locus ();
-      tree compiled_expr = unit_expression (ctx, expr.get_locus ());
+      tree compiled_expr = unit_expression (expr.get_locus ());
       tree result_reference = Backend::var_expression (result, locus);
 
       tree assignment
index 0980e6cf38af445be4ba04bfa177133b3e70b9ff..4d43a444221dab22b01880099a4be659a88bd2bd 100644 (file)
@@ -76,7 +76,7 @@ CompileExpr::visit (HIR::TupleExpr &expr)
 {
   if (expr.is_unit ())
     {
-      translated = unit_expression (ctx, expr.get_locus ());
+      translated = unit_expression (expr.get_locus ());
       return;
     }
 
@@ -111,7 +111,7 @@ CompileExpr::visit (HIR::ReturnExpr &expr)
 
   tree return_value = expr.has_return_expr ()
                        ? CompileExpr::Compile (expr.return_expr.get (), ctx)
-                       : unit_expression (ctx, expr.get_locus ());
+                       : unit_expression (expr.get_locus ());
 
   if (expr.has_return_expr ())
     {
@@ -401,7 +401,7 @@ CompileExpr::visit (HIR::StructExprStruct &struct_expr)
     }
 
   rust_assert (tyty->is_unit ());
-  translated = unit_expression (ctx, struct_expr.get_locus ());
+  translated = unit_expression (struct_expr.get_locus ());
 }
 
 void
index 40802bc3965696570c48a19cbe3ecdaee1f93ffc..86063202bf8db5f4448853f520ee2bef6309e240 100644 (file)
@@ -627,7 +627,7 @@ CompilePatternLet::visit (HIR::IdentifierPattern &pattern)
     {
       ctx->add_statement (init_expr);
 
-      auto unit_type_init_expr = unit_expression (ctx, rval_locus);
+      auto unit_type_init_expr = unit_expression (rval_locus);
       auto s = Backend::init_statement (fnctx.fndecl, var, unit_type_init_expr);
       ctx->add_statement (s);
     }
index ea8bb5b0c1215775ffb65bc3c8e742293935b965..9f999f326c3d9587d043f5fe01cb964a87eb9dae 100644 (file)
@@ -57,7 +57,7 @@ ResolvePathRef::attempt_constructor_expression_lookup (
 
   TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (lookup);
   if (adt->is_unit ())
-    return unit_expression (ctx, expr_locus);
+    return unit_expression (expr_locus);
 
   if (!adt->is_enum ())
     return error_mark_node;
index 4b42cefdb00d3078056437759894430d77231bbf..6840783beba335cef2305409147f218a42af0c84 100644 (file)
@@ -54,7 +54,7 @@ TyTyResolveCompile::compile (Context *ctx, const TyTy::BaseType *ty,
 // see: gcc/c/c-decl.cc:8230-8241
 // https://github.com/Rust-GCC/gccrs/blob/0024bc2f028369b871a65ceb11b2fddfb0f9c3aa/gcc/c/c-decl.c#L8229-L8241
 tree
-TyTyResolveCompile::get_implicit_enumeral_node_type (Context *ctx)
+TyTyResolveCompile::get_implicit_enumeral_node_type ()
 {
   // static tree enum_node = NULL_TREE;
   // if (enum_node == NULL_TREE)
@@ -88,7 +88,7 @@ TyTyResolveCompile::get_implicit_enumeral_node_type (Context *ctx)
 }
 
 tree
-TyTyResolveCompile::get_unit_type (Context *ctx)
+TyTyResolveCompile::get_unit_type ()
 {
   static tree unit_type;
   if (unit_type == nullptr)
@@ -305,7 +305,7 @@ TyTyResolveCompile::visit (const TyTy::ADTType &type)
 
          // add in the qualifier field for the variant
          tree enumeral_type
-           = TyTyResolveCompile::get_implicit_enumeral_node_type (ctx);
+           = TyTyResolveCompile::get_implicit_enumeral_node_type ();
          Backend::typed_identifier f (RUST_ENUM_DISR_FIELD_NAME, enumeral_type,
                                       ctx->get_mappings ().lookup_location (
                                         variant->get_id ()));
@@ -393,7 +393,7 @@ TyTyResolveCompile::visit (const TyTy::TupleType &type)
 {
   if (type.num_fields () == 0)
     {
-      translated = get_unit_type (ctx);
+      translated = get_unit_type ();
       return;
     }
 
@@ -686,7 +686,7 @@ TyTyResolveCompile::visit (const TyTy::StrType &type)
 void
 TyTyResolveCompile::visit (const TyTy::NeverType &)
 {
-  translated = get_unit_type (ctx);
+  translated = get_unit_type ();
 }
 
 void
index 2110f76aa46347e18993cfe984d3d1ceaecea552..e01ca430d45481054e09b780706f89ae57f03d12 100644 (file)
@@ -30,9 +30,9 @@ public:
   static tree compile (Context *ctx, const TyTy::BaseType *ty,
                       bool trait_object_mode = false);
 
-  static tree get_implicit_enumeral_node_type (Context *ctx);
+  static tree get_implicit_enumeral_node_type ();
 
-  static tree get_unit_type (Context *ctx);
+  static tree get_unit_type ();
 
   void visit (const TyTy::InferType &) override;
   void visit (const TyTy::ADTType &) override;