]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Wed, 15 May 2024 13:47:58 +0000 (13:47 +0000)
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 dfd5f9f7348eebbdf6eaef907cb4edd929d0c17c..5cf9ed948e5037bc4ac9ec947fdd8e3474650703 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 c5816584c724a96d47f1ece621b81610c5608051..c303d9f021a8b6a2d2f13f1c2cd4f560718d5b1d 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 10a70999773510a988deb6a11477b20039322445..3f5734378aa542e8019a54041e8a8a79fcdf033b 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 a8599dd8f25de444b90135664f78732741ac3f78..4d79501ccc3b8c898ff0d3e00bd1c24bd669a7a2 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 1a32f02c3ea316fb56df4b1a097d8995c27e939f..74adc3f8c177720ee3d9cbb800ca21069be40a85 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 07fb3412a69464e02903a3d2169fb739c85d1cf1..182b5fe9fdf0b6e5dc08fa2dac6f1484a1007745 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 7d879b23ddd7c2fa3ce83c086138ead04080019c..64af5aed0e16bf94f7cd6098a81ec27b4b2b3b7f 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 44bd218686ec4c4a9426e171af71601b8dc14a67..c89dfb1386fda627d5f6cab472b27d099fe03e41 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;