public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7811] gccrs: Replace Location with location_t in gccrs backend
@ 2024-01-16 18:00 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1ed62a2be747760de4f8902c7f17ce04783b9bed

commit r14-7811-g1ed62a2be747760de4f8902c7f17ce04783b9bed
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Mon Jul 10 22:33:08 2023 -0400

    gccrs: Replace Location with location_t in gccrs backend
    
    gcc/rust/ChangeLog:
    
            * backend/rust-compile-base.cc: Replace Location with location_t.
            * backend/rust-compile-base.h: Likewise.
            * backend/rust-compile-block.cc: Likewise.
            * backend/rust-compile-expr.cc: Likewise.
            * backend/rust-compile-expr.h: Likewise.
            * backend/rust-compile-extern.h: Likewise.
            * backend/rust-compile-implitem.h: Likewise.
            * backend/rust-compile-intrinsic.cc: Likewise.
            * backend/rust-compile-item.h: Likewise.
            * backend/rust-compile-pattern.h: Likewise.
            * backend/rust-compile-resolve-path.cc: Likewise.
            * backend/rust-compile-stmt.cc: Likewise.
            * backend/rust-compile-type.cc: Likewise.
            * backend/rust-compile.cc: Likewise.
            * backend/rust-constexpr.cc: Likewise.
    
    Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

Diff:
---
 gcc/rust/backend/rust-compile-base.cc         | 16 +++++-----
 gcc/rust/backend/rust-compile-base.h          | 16 +++++-----
 gcc/rust/backend/rust-compile-block.cc        |  8 ++---
 gcc/rust/backend/rust-compile-expr.cc         | 42 +++++++++++++--------------
 gcc/rust/backend/rust-compile-expr.h          | 11 +++----
 gcc/rust/backend/rust-compile-extern.h        |  7 +++--
 gcc/rust/backend/rust-compile-implitem.h      | 11 +++----
 gcc/rust/backend/rust-compile-intrinsic.cc    |  6 ++--
 gcc/rust/backend/rust-compile-item.h          |  6 ++--
 gcc/rust/backend/rust-compile-pattern.h       |  6 ++--
 gcc/rust/backend/rust-compile-resolve-path.cc |  4 +--
 gcc/rust/backend/rust-compile-stmt.cc         |  4 +--
 gcc/rust/backend/rust-compile-type.cc         |  2 +-
 gcc/rust/backend/rust-compile.cc              | 12 ++++----
 gcc/rust/backend/rust-constexpr.cc            |  2 +-
 15 files changed, 78 insertions(+), 75 deletions(-)

diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index f20df326fd4..0051d0faa20 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -490,8 +490,8 @@ HIRCompileBase::compile_function_body (tree fndecl,
       if (!fn_return_ty->is_unit ())
 	{
 	  HirId id = function_body.get_mappings ().get_hirid ();
-	  Location lvalue_locus = function_body.get_locus ();
-	  Location rvalue_locus = locus;
+	  location_t lvalue_locus = function_body.get_locus ();
+	  location_t rvalue_locus = locus;
 
 	  TyTy::BaseType *expected = fn_return_ty;
 	  TyTy::BaseType *actual = nullptr;
@@ -594,7 +594,7 @@ HIRCompileBase::compile_function (
       auto param_tyty = tyty_param.second;
       auto compiled_param_type = TyTyResolveCompile::compile (ctx, param_tyty);
 
-      Location param_locus = referenced_param.get_locus ();
+      location_t param_locus = referenced_param.get_locus ();
       Bvariable *compiled_param_var
 	= CompileFnParam::compile (ctx, fndecl, &referenced_param,
 				   compiled_param_type, param_locus);
@@ -620,8 +620,8 @@ HIRCompileBase::compile_function (
     = compile_locals_for_block (ctx, *rib, fndecl);
 
   tree enclosing_scope = NULL_TREE;
-  Location start_location = function_body->get_locus ();
-  Location end_location = function_body->get_end_locus ();
+  location_t start_location = function_body->get_locus ();
+  location_t end_location = function_body->get_end_locus ();
 
   tree code_block = ctx->get_backend ()->block (fndecl, enclosing_scope, locals,
 						start_location, end_location);
@@ -683,8 +683,8 @@ HIRCompileBase::compile_constant_item (
 
   std::vector<Bvariable *> locals;
   tree enclosing_scope = NULL_TREE;
-  Location start_location = const_value_expr->get_locus ();
-  Location end_location = const_value_expr->get_locus ();
+  location_t start_location = const_value_expr->get_locus ();
+  location_t end_location = const_value_expr->get_locus ();
   if (is_block_expr)
     {
       HIR::BlockExpr *function_body
@@ -766,7 +766,7 @@ HIRCompileBase::named_constant_expression (tree type_tree,
 tree
 HIRCompileBase::resolve_method_address (TyTy::FnType *fntype,
 					TyTy::BaseType *receiver,
-					Location expr_locus)
+					location_t expr_locus)
 {
   rust_debug_loc (expr_locus, "resolve_method_address for %s and receiver %s",
 		  fntype->debug_str ().c_str (),
diff --git a/gcc/rust/backend/rust-compile-base.h b/gcc/rust/backend/rust-compile-base.h
index fa1375b3bd1..086c0c31570 100644
--- a/gcc/rust/backend/rust-compile-base.h
+++ b/gcc/rust/backend/rust-compile-base.h
@@ -38,11 +38,11 @@ protected:
   Context *get_context () { return ctx; }
 
   tree coercion_site (HirId id, tree rvalue, TyTy::BaseType *actual,
-		      TyTy::BaseType *expected, Location lvalue_locus,
-		      Location rvalue_locus);
+		      TyTy::BaseType *expected, location_t lvalue_locus,
+		      location_t rvalue_locus);
   tree coercion_site1 (tree rvalue, TyTy::BaseType *actual,
-		       TyTy::BaseType *expected, Location lvalue_locus,
-		       Location rvalue_locus);
+		       TyTy::BaseType *expected, location_t lvalue_locus,
+		       location_t rvalue_locus);
 
   tree coerce_to_dyn_object (tree compiled_ref, const TyTy::BaseType *actual,
 			     const TyTy::DynamicObjectType *ty,
@@ -56,13 +56,13 @@ protected:
     const TyTy::BaseType *receiver, const TyTy::BaseType *root,
     location_t locus);
 
-  bool verify_array_capacities (tree ltype, tree rtype, Location ltype_locus,
-				Location rtype_locus);
+  bool verify_array_capacities (tree ltype, tree rtype, location_t ltype_locus,
+				location_t rtype_locus);
 
   tree query_compile (HirId ref, TyTy::BaseType *lookup,
 		      const HIR::PathIdentSegment &final_segment,
 		      const Analysis::NodeMapping &mappings,
-		      Location expr_locus, bool is_qualified_path);
+		      location_t expr_locus, bool is_qualified_path);
 
   tree resolve_adjustements (std::vector<Resolver::Adjustment> &adjustments,
 			     tree expression, location_t locus);
@@ -83,7 +83,7 @@ protected:
 				       tree expression, location_t locus);
 
   tree resolve_method_address (TyTy::FnType *fntype, TyTy::BaseType *receiver,
-			       Location expr_locus);
+			       location_t expr_locus);
 
   void compile_function_body (tree fndecl, HIR::BlockExpr &function_body,
 			      TyTy::BaseType *fn_return_ty);
diff --git a/gcc/rust/backend/rust-compile-block.cc b/gcc/rust/backend/rust-compile-block.cc
index 71d9cdec762..709be0ed828 100644
--- a/gcc/rust/backend/rust-compile-block.cc
+++ b/gcc/rust/backend/rust-compile-block.cc
@@ -40,8 +40,8 @@ CompileBlock::visit (HIR::BlockExpr &expr)
 {
   fncontext fnctx = ctx->peek_fn ();
   tree fndecl = fnctx.fndecl;
-  Location start_location = expr.get_locus ();
-  Location end_location = expr.get_end_locus ();
+  location_t start_location = expr.get_locus ();
+  location_t end_location = expr.get_end_locus ();
   auto body_mappings = expr.get_mappings ();
 
   Resolver::Rib *rib = nullptr;
@@ -130,8 +130,8 @@ CompileConditionalBlocks::visit (HIR::IfExprConseqElse &expr)
 
   // else block
   std::vector<Bvariable *> locals;
-  Location start_location = expr.get_else_block ()->get_locus ();
-  Location end_location = expr.get_else_block ()->get_locus (); // FIXME
+  location_t start_location = expr.get_else_block ()->get_locus ();
+  location_t end_location = expr.get_else_block ()->get_locus (); // FIXME
   tree enclosing_scope = ctx->peek_enclosing_scope ();
   tree else_block = ctx->get_backend ()->block (fndecl, enclosing_scope, locals,
 						start_location, end_location);
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index c055580cc08..c06c9811ed1 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -118,10 +118,10 @@ CompileExpr::visit (HIR::ReturnExpr &expr)
   if (expr.has_return_expr ())
     {
       HirId id = expr.get_mappings ().get_hirid ();
-      Location rvalue_locus = expr.return_expr->get_locus ();
+      location_t rvalue_locus = expr.return_expr->get_locus ();
 
       TyTy::BaseType *expected = fncontext.retty;
-      Location lvalue_locus
+      location_t lvalue_locus
 	= ctx->get_mappings ()->lookup_location (expected->get_ref ());
 
       TyTy::BaseType *actual = nullptr;
@@ -675,8 +675,8 @@ CompileExpr::visit (HIR::WhileLoopExpr &expr)
     }
 
   std::vector<Bvariable *> locals;
-  Location start_location = expr.get_loop_block ()->get_locus ();
-  Location end_location = expr.get_loop_block ()->get_locus (); // FIXME
+  location_t start_location = expr.get_loop_block ()->get_locus ();
+  location_t end_location = expr.get_loop_block ()->get_locus (); // FIXME
 
   tree enclosing_scope = ctx->peek_enclosing_scope ();
   tree loop_block
@@ -1453,7 +1453,7 @@ CompileExpr::visit (HIR::MatchExpr &expr)
 
   // setup the end label so the cases can exit properly
   tree fndecl = fnctx.fndecl;
-  Location end_label_locus = expr.get_locus (); // FIXME
+  location_t end_label_locus = expr.get_locus (); // FIXME
   tree end_label
     = ctx->get_backend ()->label (fndecl,
 				  "" /* empty creates an artificial label */,
@@ -1462,8 +1462,8 @@ CompileExpr::visit (HIR::MatchExpr &expr)
     = ctx->get_backend ()->label_definition_statement (end_label);
 
   // setup the switch-body-block
-  Location start_location = UNKNOWN_LOCATION; // FIXME
-  Location end_location = UNKNOWN_LOCATION;   // FIXME
+  location_t start_location = UNKNOWN_LOCATION; // FIXME
+  location_t end_location = UNKNOWN_LOCATION;	// FIXME
   tree switch_body_block
     = ctx->get_backend ()->block (fndecl, enclosing_scope, {}, start_location,
 				  end_location);
@@ -1476,7 +1476,7 @@ CompileExpr::visit (HIR::MatchExpr &expr)
       rust_assert (kase_arm.get_patterns ().size () > 0);
 
       // generate implicit label
-      Location arm_locus = kase_arm.get_locus ();
+      location_t arm_locus = kase_arm.get_locus ();
       tree case_label = ctx->get_backend ()->label (
 	fndecl, "" /* empty creates an artificial label */, arm_locus);
 
@@ -1577,9 +1577,9 @@ CompileExpr::visit (HIR::CallExpr &expr)
 	  rust_assert (ok);
 
 	  // coerce it if required
-	  Location lvalue_locus
+	  location_t lvalue_locus
 	    = ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
-	  Location rvalue_locus = argument->get_locus ();
+	  location_t rvalue_locus = argument->get_locus ();
 	  rvalue
 	    = coercion_site (argument->get_mappings ().get_hirid (), rvalue,
 			     actual, expected, lvalue_locus, rvalue_locus);
@@ -1684,9 +1684,9 @@ CompileExpr::visit (HIR::CallExpr &expr)
       rust_assert (ok);
 
       // coerce it if required
-      Location lvalue_locus
+      location_t lvalue_locus
 	= ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
-      Location rvalue_locus = argument->get_locus ();
+      location_t rvalue_locus = argument->get_locus ();
       rvalue = coercion_site (argument->get_mappings ().get_hirid (), rvalue,
 			      actual, expected, lvalue_locus, rvalue_locus);
 
@@ -1782,9 +1782,9 @@ CompileExpr::visit (HIR::MethodCallExpr &expr)
       rust_assert (ok);
 
       // coerce it if required
-      Location lvalue_locus
+      location_t lvalue_locus
 	= ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
-      Location rvalue_locus = argument->get_locus ();
+      location_t rvalue_locus = argument->get_locus ();
       rvalue = coercion_site (argument->get_mappings ().get_hirid (), rvalue,
 			      actual, expected, lvalue_locus, rvalue_locus);
 
@@ -1800,7 +1800,7 @@ tree
 CompileExpr::get_fn_addr_from_dyn (const TyTy::DynamicObjectType *dyn,
 				   TyTy::BaseType *receiver,
 				   TyTy::FnType *fntype, tree receiver_ref,
-				   Location expr_locus)
+				   location_t expr_locus)
 {
   size_t offs = 0;
   const Resolver::TraitItemReference *ref = nullptr;
@@ -1843,7 +1843,7 @@ tree
 CompileExpr::get_receiver_from_dyn (const TyTy::DynamicObjectType *dyn,
 				    TyTy::BaseType *receiver,
 				    TyTy::FnType *fntype, tree receiver_ref,
-				    Location expr_locus)
+				    location_t expr_locus)
 {
   // access the offs + 1 for the fnptr and offs=0 for the reciever obj
   return ctx->get_backend ()->struct_field_expression (receiver_ref, 0,
@@ -2187,7 +2187,7 @@ CompileExpr::visit (HIR::ArrayExpr &expr)
 }
 
 tree
-CompileExpr::array_value_expr (Location expr_locus,
+CompileExpr::array_value_expr (location_t expr_locus,
 			       const TyTy::ArrayType &array_tyty,
 			       tree array_type, HIR::ArrayElemsValues &elems)
 {
@@ -2207,7 +2207,7 @@ CompileExpr::array_value_expr (Location expr_locus,
 }
 
 tree
-CompileExpr::array_copied_expr (Location expr_locus,
+CompileExpr::array_copied_expr (location_t expr_locus,
 				const TyTy::ArrayType &array_tyty,
 				tree array_type, HIR::ArrayElemsCopied &elems)
 {
@@ -2429,7 +2429,7 @@ HIRCompileBase::resolve_unsized_dyn_adjustment (
   Resolver::Adjustment &adjustment, tree expression, location_t locus)
 {
   tree rvalue = expression;
-  Location rvalue_locus = locus;
+  location_t rvalue_locus = locus;
 
   const TyTy::BaseType *actual = adjustment.get_actual ();
   const TyTy::BaseType *expected = adjustment.get_expected ();
@@ -2765,8 +2765,8 @@ CompileExpr::generate_closure_function (HIR::ClosureExpr &expr,
     }
 
   tree enclosing_scope = NULL_TREE;
-  Location start_location = function_body->get_locus ();
-  Location end_location = function_body->get_locus ();
+  location_t start_location = function_body->get_locus ();
+  location_t end_location = function_body->get_locus ();
   if (is_block_expr)
     {
       HIR::BlockExpr *body = static_cast<HIR::BlockExpr *> (function_body);
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index e596d173ab5..a6db70ea69b 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -92,11 +92,11 @@ public:
 protected:
   tree get_fn_addr_from_dyn (const TyTy::DynamicObjectType *dyn,
 			     TyTy::BaseType *receiver, TyTy::FnType *fntype,
-			     tree receiver_ref, Location expr_locus);
+			     tree receiver_ref, location_t expr_locus);
 
   tree get_receiver_from_dyn (const TyTy::DynamicObjectType *dyn,
 			      TyTy::BaseType *receiver, TyTy::FnType *fntype,
-			      tree receiver_ref, Location expr_locus);
+			      tree receiver_ref, location_t expr_locus);
 
   tree
   resolve_operator_overload (Analysis::RustLangItem::ItemType lang_item_type,
@@ -126,10 +126,11 @@ protected:
 
   tree type_cast_expression (tree type_to_cast_to, tree expr, location_t locus);
 
-  tree array_value_expr (Location expr_locus, const TyTy::ArrayType &array_tyty,
-			 tree array_type, HIR::ArrayElemsValues &elems);
+  tree array_value_expr (location_t expr_locus,
+			 const TyTy::ArrayType &array_tyty, tree array_type,
+			 HIR::ArrayElemsValues &elems);
 
-  tree array_copied_expr (Location expr_locus,
+  tree array_copied_expr (location_t expr_locus,
 			  const TyTy::ArrayType &array_tyty, tree array_type,
 			  HIR::ArrayElemsCopied &elems);
 
diff --git a/gcc/rust/backend/rust-compile-extern.h b/gcc/rust/backend/rust-compile-extern.h
index 29a886864ed..692e4e5fe6c 100644
--- a/gcc/rust/backend/rust-compile-extern.h
+++ b/gcc/rust/backend/rust-compile-extern.h
@@ -33,7 +33,7 @@ public:
   static tree compile (HIR::ExternalItem *item, Context *ctx,
 		       TyTy::BaseType *concrete = nullptr,
 		       bool is_query_mode = false,
-		       Location ref_locus = UNDEF_LOCATION)
+		       location_t ref_locus = UNDEF_LOCATION)
   {
     CompileExternItem compiler (ctx, concrete, ref_locus);
     item->accept_vis (compiler);
@@ -157,14 +157,15 @@ public:
   }
 
 private:
-  CompileExternItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus)
+  CompileExternItem (Context *ctx, TyTy::BaseType *concrete,
+		     location_t ref_locus)
     : HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
       ref_locus (ref_locus)
   {}
 
   TyTy::BaseType *concrete;
   tree reference;
-  Location ref_locus;
+  location_t ref_locus;
 };
 
 } // namespace Compile
diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h
index b29b7a5a3d4..d9194a2d2e0 100644
--- a/gcc/rust/backend/rust-compile-implitem.h
+++ b/gcc/rust/backend/rust-compile-implitem.h
@@ -31,7 +31,7 @@ public:
   static tree Compile (HIR::ImplItem *item, Context *ctx,
 		       TyTy::BaseType *concrete = nullptr,
 		       bool is_query_mode = false,
-		       Location ref_locus = UNDEF_LOCATION)
+		       location_t ref_locus = UNDEF_LOCATION)
   {
     CompileInherentImplItem compiler (ctx, concrete, ref_locus);
     item->accept_vis (compiler);
@@ -45,7 +45,7 @@ public:
 
 private:
   CompileInherentImplItem (Context *ctx, TyTy::BaseType *concrete,
-			   Location ref_locus)
+			   location_t ref_locus)
     : CompileItem (ctx, concrete, ref_locus)
   {}
 };
@@ -55,7 +55,7 @@ class CompileTraitItem : public HIRCompileBase, public HIR::HIRTraitItemVisitor
 public:
   static tree Compile (HIR::TraitItem *item, Context *ctx,
 		       TyTy::BaseType *concrete, bool is_query_mode = false,
-		       Location ref_locus = UNDEF_LOCATION)
+		       location_t ref_locus = UNDEF_LOCATION)
   {
     CompileTraitItem compiler (ctx, concrete, ref_locus);
     item->accept_vis (compiler);
@@ -73,14 +73,15 @@ public:
   void visit (HIR::TraitItemType &typ) override {}
 
 private:
-  CompileTraitItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus)
+  CompileTraitItem (Context *ctx, TyTy::BaseType *concrete,
+		    location_t ref_locus)
     : HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
       ref_locus (ref_locus)
   {}
 
   TyTy::BaseType *concrete;
   tree reference;
-  Location ref_locus;
+  location_t ref_locus;
 };
 
 } // namespace Compile
diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc b/gcc/rust/backend/rust-compile-intrinsic.cc
index 4f680e7b43d..867318af1da 100644
--- a/gcc/rust/backend/rust-compile-intrinsic.cc
+++ b/gcc/rust/backend/rust-compile-intrinsic.cc
@@ -282,7 +282,7 @@ compile_fn_params (Context *ctx, TyTy::FnType *fntype, tree fndecl,
       auto &param_tyty = parm.second;
       auto compiled_param_type = TyTyResolveCompile::compile (ctx, param_tyty);
 
-      Location param_locus = referenced_param->get_locus ();
+      location_t param_locus = referenced_param->get_locus ();
       Bvariable *compiled_param_var
 	= CompileFnParam::compile (ctx, fndecl, referenced_param,
 				   compiled_param_type, param_locus);
@@ -323,8 +323,8 @@ static void
 enter_intrinsic_block (Context *ctx, tree fndecl)
 {
   tree enclosing_scope = NULL_TREE;
-  Location start_location = UNDEF_LOCATION;
-  Location end_location = UNDEF_LOCATION;
+  location_t start_location = UNDEF_LOCATION;
+  location_t end_location = UNDEF_LOCATION;
 
   auto block = ctx->get_backend ()->block (fndecl, enclosing_scope, {},
 					   start_location, end_location);
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h
index 441c448be00..1c877fa328d 100644
--- a/gcc/rust/backend/rust-compile-item.h
+++ b/gcc/rust/backend/rust-compile-item.h
@@ -32,7 +32,7 @@ public:
   static tree compile (HIR::Item *item, Context *ctx,
 		       TyTy::BaseType *concrete = nullptr,
 		       bool is_query_mode = false,
-		       Location ref_locus = UNDEF_LOCATION)
+		       location_t ref_locus = UNDEF_LOCATION)
   {
     CompileItem compiler (ctx, concrete, ref_locus);
     item->accept_vis (compiler);
@@ -72,14 +72,14 @@ public:
   void visit (HIR::ExprStmt &) override {}
 
 protected:
-  CompileItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus)
+  CompileItem (Context *ctx, TyTy::BaseType *concrete, location_t ref_locus)
     : HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node),
       ref_locus (ref_locus)
   {}
 
   TyTy::BaseType *concrete;
   tree reference;
-  Location ref_locus;
+  location_t ref_locus;
 };
 
 } // namespace Compile
diff --git a/gcc/rust/backend/rust-compile-pattern.h b/gcc/rust/backend/rust-compile-pattern.h
index dfc67d69624..e8e4e5d2edd 100644
--- a/gcc/rust/backend/rust-compile-pattern.h
+++ b/gcc/rust/backend/rust-compile-pattern.h
@@ -108,7 +108,7 @@ class CompilePatternLet : public HIRCompileBase, public HIR::HIRPatternVisitor
 {
 public:
   static void Compile (HIR::Pattern *pattern, tree init_expr,
-		       TyTy::BaseType *ty, Location rval_locus, Context *ctx)
+		       TyTy::BaseType *ty, location_t rval_locus, Context *ctx)
   {
     CompilePatternLet compiler (ctx, init_expr, ty, rval_locus);
     pattern->accept_vis (compiler);
@@ -176,14 +176,14 @@ public:
 
 protected:
   CompilePatternLet (Context *ctx, tree init_expr, TyTy::BaseType *ty,
-		     Location rval_locus)
+		     location_t rval_locus)
     : HIRCompileBase (ctx), init_expr (init_expr), ty (ty),
       rval_locus (rval_locus)
   {}
 
   tree init_expr;
   TyTy::BaseType *ty;
-  Location rval_locus;
+  location_t rval_locus;
 };
 
 } // namespace Compile
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc
index 284f4c6e91e..df2bd0d316f 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.cc
+++ b/gcc/rust/backend/rust-compile-resolve-path.cc
@@ -46,7 +46,7 @@ ResolvePathRef::visit (HIR::PathInExpression &expr)
 tree
 ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment,
 			 const Analysis::NodeMapping &mappings,
-			 Location expr_locus, bool is_qualified_path)
+			 location_t expr_locus, bool is_qualified_path)
 {
   TyTy::BaseType *lookup = nullptr;
   bool ok = ctx->get_tyctx ()->lookup_type (mappings.get_hirid (), &lookup);
@@ -174,7 +174,7 @@ tree
 HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup,
 			       const HIR::PathIdentSegment &final_segment,
 			       const Analysis::NodeMapping &mappings,
-			       Location expr_locus, bool is_qualified_path)
+			       location_t expr_locus, bool is_qualified_path)
 {
   HIR::Item *resolved_item = ctx->get_mappings ()->lookup_hir_item (ref);
   HirId parent_block;
diff --git a/gcc/rust/backend/rust-compile-stmt.cc b/gcc/rust/backend/rust-compile-stmt.cc
index fb8571074b2..2d9578dac02 100644
--- a/gcc/rust/backend/rust-compile-stmt.cc
+++ b/gcc/rust/backend/rust-compile-stmt.cc
@@ -71,8 +71,8 @@ CompileStmt::visit (HIR::LetStmt &stmt)
     stmt.get_init_expr ()->get_mappings ().get_hirid (), &actual);
   rust_assert (ok);
 
-  Location lvalue_locus = stmt.get_pattern ()->get_locus ();
-  Location rvalue_locus = stmt.get_init_expr ()->get_locus ();
+  location_t lvalue_locus = stmt.get_pattern ()->get_locus ();
+  location_t rvalue_locus = stmt.get_init_expr ()->get_locus ();
   TyTy::BaseType *expected = ty;
   init = coercion_site (stmt.get_mappings ().get_hirid (), init, actual,
 			expected, lvalue_locus, rvalue_locus);
diff --git a/gcc/rust/backend/rust-compile-type.cc b/gcc/rust/backend/rust-compile-type.cc
index 0eaa7b787a0..11f2a2fef98 100644
--- a/gcc/rust/backend/rust-compile-type.cc
+++ b/gcc/rust/backend/rust-compile-type.cc
@@ -185,7 +185,7 @@ TyTyResolveCompile::visit (const TyTy::FnType &type)
   if (!should_be_void)
     {
       auto ret = TyTyResolveCompile::compile (ctx, hir_type, trait_object_mode);
-      Location return_type_locus
+      location_t return_type_locus
 	= ctx->get_mappings ()->lookup_location (hir_type->get_ref ());
       results.push_back (
 	Backend::typed_identifier ("_", ret, return_type_locus));
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index f406220c959..2c2a2361e59 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -51,8 +51,8 @@ CompileCrate::go ()
 
 tree
 HIRCompileBase::coercion_site (HirId id, tree rvalue, TyTy::BaseType *rval,
-			       TyTy::BaseType *lval, Location lvalue_locus,
-			       Location rvalue_locus)
+			       TyTy::BaseType *lval, location_t lvalue_locus,
+			       location_t rvalue_locus)
 {
   std::vector<Resolver::Adjustment> *adjustments = nullptr;
   bool ok = ctx->get_tyctx ()->lookup_autoderef_mappings (id, &adjustments);
@@ -66,8 +66,8 @@ HIRCompileBase::coercion_site (HirId id, tree rvalue, TyTy::BaseType *rval,
 
 tree
 HIRCompileBase::coercion_site1 (tree rvalue, TyTy::BaseType *rval,
-				TyTy::BaseType *lval, Location lvalue_locus,
-				Location rvalue_locus)
+				TyTy::BaseType *lval, location_t lvalue_locus,
+				location_t rvalue_locus)
 {
   if (rvalue == error_mark_node)
     return error_mark_node;
@@ -361,8 +361,8 @@ HIRCompileBase::compute_address_for_trait_item (
 
 bool
 HIRCompileBase::verify_array_capacities (tree ltype, tree rtype,
-					 Location lvalue_locus,
-					 Location rvalue_locus)
+					 location_t lvalue_locus,
+					 location_t rvalue_locus)
 {
   rust_assert (ltype != NULL_TREE);
   rust_assert (rtype != NULL_TREE);
diff --git a/gcc/rust/backend/rust-constexpr.cc b/gcc/rust/backend/rust-constexpr.cc
index a80cfd7600b..c235f9db22a 100644
--- a/gcc/rust/backend/rust-constexpr.cc
+++ b/gcc/rust/backend/rust-constexpr.cc
@@ -4522,7 +4522,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
 	    // error ("invalid type for parameter %d of %<constexpr%> "
 	    //        "function %q+#D",
 	    //        DECL_PARM_INDEX (parm), fun);
-	    Location locus = DECL_SOURCE_LOCATION (fun);
+	    location_t locus = DECL_SOURCE_LOCATION (fun);
 	    rust_error_at (
 	      locus, "invalid type for parameter %d of %<constexpr%> function",
 	      DECL_PARM_INDEX (parm));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 18:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:00 [gcc r14-7811] gccrs: Replace Location with location_t in gccrs backend Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).