aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-base.cc14
-rw-r--r--gcc/rust/backend/rust-compile-base.h28
-rw-r--r--gcc/rust/backend/rust-compile-block.cc4
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc12
-rw-r--r--gcc/rust/backend/rust-compile-expr.h2
-rw-r--r--gcc/rust/backend/rust-compile-fnparam.cc8
-rw-r--r--gcc/rust/backend/rust-compile-fnparam.h10
-rw-r--r--gcc/rust/backend/rust-compile-intrinsic.cc8
-rw-r--r--gcc/rust/backend/rust-compile-pattern.cc2
-rw-r--r--gcc/rust/backend/rust-compile-resolve-path.h2
-rw-r--r--gcc/rust/backend/rust-compile.cc4
11 files changed, 48 insertions, 46 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index 522487e..f20df32 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -358,7 +358,7 @@ HIRCompileBase::setup_abi_options (tree fndecl, ABI abi)
// it is fine to use ARRAY_REFs for vector subscripts on vector
// register variables.
bool
-HIRCompileBase::mark_addressable (tree exp, Location locus)
+HIRCompileBase::mark_addressable (tree exp, location_t locus)
{
tree x = exp;
@@ -429,7 +429,7 @@ HIRCompileBase::address_expression (tree expr, Location location)
}
tree
-HIRCompileBase::indirect_expression (tree expr, Location locus)
+HIRCompileBase::indirect_expression (tree expr, location_t locus)
{
if (expr == error_mark_node)
return error_mark_node;
@@ -483,7 +483,7 @@ HIRCompileBase::compile_function_body (tree fndecl,
if (function_body.has_expr ())
{
- Location locus = function_body.get_final_expr ()->get_locus ();
+ location_t locus = function_body.get_final_expr ()->get_locus ();
tree return_value = CompileExpr::Compile (function_body.expr.get (), ctx);
// we can only return this if non unit value return type
@@ -523,7 +523,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 locus = function_body.get_locus ();
+ location_t locus = function_body.get_locus ();
tree return_value = unit_expression (ctx, locus);
tree return_stmt
= ctx->get_backend ()->return_statement (fndecl, return_value, locus);
@@ -536,7 +536,7 @@ HIRCompileBase::compile_function (
const std::string &fn_name, HIR::SelfParam &self_param,
std::vector<HIR::FunctionParam> &function_params,
const HIR::FunctionQualifiers &qualifiers, HIR::Visibility &visibility,
- AST::AttrVec &outer_attrs, Location locus, HIR::BlockExpr *function_body,
+ AST::AttrVec &outer_attrs, location_t locus, HIR::BlockExpr *function_body,
const Resolver::CanonicalPath *canonical_path, TyTy::FnType *fntype)
{
tree compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype);
@@ -660,7 +660,7 @@ HIRCompileBase::compile_function (
tree
HIRCompileBase::compile_constant_item (
TyTy::BaseType *resolved_type, const Resolver::CanonicalPath *canonical_path,
- HIR::Expr *const_value_expr, Location locus)
+ HIR::Expr *const_value_expr, location_t locus)
{
const std::string &ident = canonical_path->get ();
@@ -885,7 +885,7 @@ HIRCompileBase::resolve_method_address (TyTy::FnType *fntype,
}
tree
-HIRCompileBase::unit_expression (Context *ctx, Location locus)
+HIRCompileBase::unit_expression (Context *ctx, location_t locus)
{
tree unit_type = TyTyResolveCompile::get_unit_type (ctx);
return ctx->get_backend ()->constructor_expression (unit_type, false, {}, -1,
diff --git a/gcc/rust/backend/rust-compile-base.h b/gcc/rust/backend/rust-compile-base.h
index 203705a..fa1375b 100644
--- a/gcc/rust/backend/rust-compile-base.h
+++ b/gcc/rust/backend/rust-compile-base.h
@@ -45,14 +45,16 @@ protected:
Location rvalue_locus);
tree coerce_to_dyn_object (tree compiled_ref, const TyTy::BaseType *actual,
- const TyTy::DynamicObjectType *ty, Location locus);
+ const TyTy::DynamicObjectType *ty,
+ location_t locus);
tree compute_address_for_trait_item (
const Resolver::TraitItemReference *ref,
const TyTy::TypeBoundPredicate *predicate,
std::vector<std::pair<Resolver::TraitReference *, HIR::ImplBlock *>>
&receiver_bounds,
- const TyTy::BaseType *receiver, const TyTy::BaseType *root, Location locus);
+ 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);
@@ -63,22 +65,22 @@ protected:
Location expr_locus, bool is_qualified_path);
tree resolve_adjustements (std::vector<Resolver::Adjustment> &adjustments,
- tree expression, Location locus);
+ tree expression, location_t locus);
tree resolve_deref_adjustment (Resolver::Adjustment &adjustment,
- tree expression, Location locus);
+ tree expression, location_t locus);
tree resolve_indirection_adjustment (Resolver::Adjustment &adjustment,
- tree expression, Location locus);
+ tree expression, location_t locus);
tree resolve_unsized_adjustment (Resolver::Adjustment &adjustment,
- tree expression, Location locus);
+ tree expression, location_t locus);
tree resolve_unsized_slice_adjustment (Resolver::Adjustment &adjustment,
- tree expression, Location locus);
+ tree expression, location_t locus);
tree resolve_unsized_dyn_adjustment (Resolver::Adjustment &adjustment,
- tree expression, Location locus);
+ tree expression, location_t locus);
tree resolve_method_address (TyTy::FnType *fntype, TyTy::BaseType *receiver,
Location expr_locus);
@@ -88,17 +90,17 @@ protected:
tree compile_constant_item (TyTy::BaseType *resolved_type,
const Resolver::CanonicalPath *canonical_path,
- HIR::Expr *const_value_expr, Location locus);
+ HIR::Expr *const_value_expr, location_t locus);
tree compile_function (const std::string &fn_name, HIR::SelfParam &self_param,
std::vector<HIR::FunctionParam> &function_params,
const HIR::FunctionQualifiers &qualifiers,
HIR::Visibility &visibility, AST::AttrVec &outer_attrs,
- Location locus, HIR::BlockExpr *function_body,
+ location_t locus, HIR::BlockExpr *function_body,
const Resolver::CanonicalPath *canonical_path,
TyTy::FnType *fntype);
- static tree unit_expression (Context *ctx, Location locus);
+ static tree unit_expression (Context *ctx, location_t locus);
static void setup_fndecl (tree fndecl, bool is_main_entry_point,
bool is_generic_fn, HIR::Visibility &visibility,
@@ -126,9 +128,9 @@ protected:
static void setup_abi_options (tree fndecl, ABI abi);
- static tree address_expression (tree expr, Location locus);
+ static tree address_expression (tree expr, location_t locus);
- static tree indirect_expression (tree expr, Location locus);
+ static tree indirect_expression (tree expr, location_t locus);
static bool mark_addressable (tree, Location);
diff --git a/gcc/rust/backend/rust-compile-block.cc b/gcc/rust/backend/rust-compile-block.cc
index d6a106e..71d9cde 100644
--- a/gcc/rust/backend/rust-compile-block.cc
+++ b/gcc/rust/backend/rust-compile-block.cc
@@ -74,7 +74,7 @@ CompileBlock::visit (HIR::BlockExpr &expr)
tree compiled_expr = CompileExpr::Compile (expr.expr.get (), ctx);
if (result != nullptr)
{
- Location locus = expr.get_final_expr ()->get_locus ();
+ location_t locus = expr.get_final_expr ()->get_locus ();
tree result_reference
= ctx->get_backend ()->var_expression (result, locus);
@@ -87,7 +87,7 @@ CompileBlock::visit (HIR::BlockExpr &expr)
}
else if (result != nullptr)
{
- Location locus = expr.get_locus ();
+ location_t locus = expr.get_locus ();
tree compiled_expr = unit_expression (ctx, expr.get_locus ());
tree result_reference
= ctx->get_backend ()->var_expression (result, locus);
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index 80cc608..c055580 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -2301,7 +2301,7 @@ CompileExpr::array_copied_expr (Location expr_locus,
tree
HIRCompileBase::resolve_adjustements (
std::vector<Resolver::Adjustment> &adjustments, tree expression,
- Location locus)
+ location_t locus)
{
tree e = expression;
for (auto &adjustment : adjustments)
@@ -2340,7 +2340,7 @@ HIRCompileBase::resolve_adjustements (
tree
HIRCompileBase::resolve_deref_adjustment (Resolver::Adjustment &adjustment,
- tree expression, Location locus)
+ tree expression, location_t locus)
{
rust_assert (adjustment.is_deref_adjustment ()
|| adjustment.is_deref_mut_adjustment ());
@@ -2366,14 +2366,14 @@ HIRCompileBase::resolve_deref_adjustment (Resolver::Adjustment &adjustment,
tree
HIRCompileBase::resolve_indirection_adjustment (
- Resolver::Adjustment &adjustment, tree expression, Location locus)
+ Resolver::Adjustment &adjustment, tree expression, location_t locus)
{
return indirect_expression (expression, locus);
}
tree
HIRCompileBase::resolve_unsized_adjustment (Resolver::Adjustment &adjustment,
- tree expression, Location locus)
+ tree expression, location_t locus)
{
bool expect_slice
= adjustment.get_expected ()->get_kind () == TyTy::TypeKind::SLICE;
@@ -2394,7 +2394,7 @@ HIRCompileBase::resolve_unsized_adjustment (Resolver::Adjustment &adjustment,
tree
HIRCompileBase::resolve_unsized_slice_adjustment (
- Resolver::Adjustment &adjustment, tree expression, Location locus)
+ Resolver::Adjustment &adjustment, tree expression, location_t locus)
{
// assumes this is an array
tree expr_type = TREE_TYPE (expression);
@@ -2426,7 +2426,7 @@ HIRCompileBase::resolve_unsized_slice_adjustment (
tree
HIRCompileBase::resolve_unsized_dyn_adjustment (
- Resolver::Adjustment &adjustment, tree expression, Location locus)
+ Resolver::Adjustment &adjustment, tree expression, location_t locus)
{
tree rvalue = expression;
Location rvalue_locus = locus;
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 95c0052..e596d17 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -124,7 +124,7 @@ protected:
tree compile_byte_string_literal (const HIR::LiteralExpr &expr,
const TyTy::BaseType *tyty);
- tree type_cast_expression (tree type_to_cast_to, tree expr, Location locus);
+ 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);
diff --git a/gcc/rust/backend/rust-compile-fnparam.cc b/gcc/rust/backend/rust-compile-fnparam.cc
index 9a9d5b3..1072ae0 100644
--- a/gcc/rust/backend/rust-compile-fnparam.cc
+++ b/gcc/rust/backend/rust-compile-fnparam.cc
@@ -25,14 +25,14 @@ namespace Rust {
namespace Compile {
CompileFnParam::CompileFnParam (Context *ctx, tree fndecl, tree decl_type,
- Location locus)
+ location_t locus)
: HIRCompileBase (ctx), fndecl (fndecl), decl_type (decl_type), locus (locus),
compiled_param (ctx->get_backend ()->error_variable ())
{}
Bvariable *
CompileFnParam::compile (Context *ctx, tree fndecl, HIR::FunctionParam *param,
- tree decl_type, Location locus)
+ tree decl_type, location_t locus)
{
CompileFnParam compiler (ctx, fndecl, decl_type, locus);
param->get_param_name ()->accept_vis (compiler);
@@ -41,7 +41,7 @@ CompileFnParam::compile (Context *ctx, tree fndecl, HIR::FunctionParam *param,
Bvariable *
CompileFnParam::compile (Context *ctx, tree fndecl, HIR::Pattern *param,
- tree decl_type, Location locus)
+ tree decl_type, location_t locus)
{
CompileFnParam compiler (ctx, fndecl, decl_type, locus);
param->accept_vis (compiler);
@@ -90,7 +90,7 @@ CompileFnParam::visit (HIR::ReferencePattern &pattern)
Bvariable *
CompileSelfParam::compile (Context *ctx, tree fndecl, HIR::SelfParam &self,
- tree decl_type, Location locus)
+ tree decl_type, location_t locus)
{
bool is_immutable
= self.get_self_kind () == HIR::SelfParam::ImplicitSelfKind::IMM
diff --git a/gcc/rust/backend/rust-compile-fnparam.h b/gcc/rust/backend/rust-compile-fnparam.h
index 10b4efb..9b50b19 100644
--- a/gcc/rust/backend/rust-compile-fnparam.h
+++ b/gcc/rust/backend/rust-compile-fnparam.h
@@ -30,9 +30,9 @@ class CompileFnParam : private HIRCompileBase, protected HIR::HIRPatternVisitor
public:
static Bvariable *compile (Context *ctx, tree fndecl,
HIR::FunctionParam *param, tree decl_type,
- Location locus);
+ location_t locus);
static Bvariable *compile (Context *ctx, tree fndecl, HIR::Pattern *param,
- tree decl_type, Location locus);
+ tree decl_type, location_t locus);
void visit (HIR::IdentifierPattern &pattern) override;
void visit (HIR::WildcardPattern &pattern) override;
@@ -50,13 +50,13 @@ public:
void visit (HIR::TuplePattern &) override {}
private:
- CompileFnParam (Context *ctx, tree fndecl, tree decl_type, Location locus);
+ CompileFnParam (Context *ctx, tree fndecl, tree decl_type, location_t locus);
tree create_tmp_param_var (tree decl_type);
tree fndecl;
tree decl_type;
- Location locus;
+ location_t locus;
Bvariable *compiled_param;
};
@@ -64,7 +64,7 @@ class CompileSelfParam : private HIRCompileBase
{
public:
static Bvariable *compile (Context *ctx, tree fndecl, HIR::SelfParam &self,
- tree decl_type, Location locus);
+ tree decl_type, location_t locus);
};
} // namespace Compile
diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc b/gcc/rust/backend/rust-compile-intrinsic.cc
index 0521d85..4f680e7 100644
--- a/gcc/rust/backend/rust-compile-intrinsic.cc
+++ b/gcc/rust/backend/rust-compile-intrinsic.cc
@@ -52,8 +52,8 @@ is_basic_integer_type (TyTy::BaseType *type)
}
static bool
-check_for_basic_integer_type (const std::string &intrinsic_str, Location locus,
- TyTy::BaseType *type)
+check_for_basic_integer_type (const std::string &intrinsic_str,
+ location_t locus, TyTy::BaseType *type)
{
auto is_basic_integer = is_basic_integer_type (type);
if (!is_basic_integer)
@@ -227,7 +227,7 @@ Intrinsics::compile (TyTy::FnType *fntype)
if (it != generic_intrinsics.end ())
return it->second (ctx, fntype);
- Location locus = ctx->get_mappings ()->lookup_location (fntype->get_ref ());
+ location_t locus = ctx->get_mappings ()->lookup_location (fntype->get_ref ());
rust_error_at (locus, ErrorCode ("E0093"),
"unrecognized intrinsic function: %<%s%>",
fntype->get_identifier ().c_str ());
@@ -791,7 +791,7 @@ prefetch_data_handler (Context *ctx, TyTy::FnType *fntype, Prefetch kind)
}
static std::string
-build_atomic_builtin_name (const std::string &prefix, Location locus,
+build_atomic_builtin_name (const std::string &prefix, location_t locus,
TyTy::BaseType *operand_type)
{
static const std::map<std::string, std::string> allowed_types = {
diff --git a/gcc/rust/backend/rust-compile-pattern.cc b/gcc/rust/backend/rust-compile-pattern.cc
index c655690..54bfda1 100644
--- a/gcc/rust/backend/rust-compile-pattern.cc
+++ b/gcc/rust/backend/rust-compile-pattern.cc
@@ -106,7 +106,7 @@ CompilePatternCaseLabelExpr::visit (HIR::LiteralPattern &pattern)
static tree
compile_range_pattern_bound (HIR::RangePatternBound *bound,
- Analysis::NodeMapping mappings, Location locus,
+ Analysis::NodeMapping mappings, location_t locus,
Context *ctx)
{
tree result = NULL_TREE;
diff --git a/gcc/rust/backend/rust-compile-resolve-path.h b/gcc/rust/backend/rust-compile-resolve-path.h
index 05c882e..ce559fc 100644
--- a/gcc/rust/backend/rust-compile-resolve-path.h
+++ b/gcc/rust/backend/rust-compile-resolve-path.h
@@ -62,7 +62,7 @@ public:
{}
tree resolve (const HIR::PathIdentSegment &final_segment,
- const Analysis::NodeMapping &mappings, Location locus,
+ const Analysis::NodeMapping &mappings, location_t locus,
bool is_qualified_path);
tree resolved;
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index b4c46e9..f406220 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -181,7 +181,7 @@ tree
HIRCompileBase::coerce_to_dyn_object (tree compiled_ref,
const TyTy::BaseType *actual,
const TyTy::DynamicObjectType *ty,
- Location locus)
+ location_t locus)
{
// DST's get wrapped in a pseudo reference that doesnt exist...
const TyTy::ReferenceType r (ctx->get_mappings ()->get_next_hir_id (),
@@ -232,7 +232,7 @@ HIRCompileBase::compute_address_for_trait_item (
const TyTy::TypeBoundPredicate *predicate,
std::vector<std::pair<Resolver::TraitReference *, HIR::ImplBlock *>>
&receiver_bounds,
- const TyTy::BaseType *receiver, const TyTy::BaseType *root, Location locus)
+ const TyTy::BaseType *receiver, const TyTy::BaseType *root, location_t locus)
{
// There are two cases here one where its an item which has an implementation
// within a trait-impl-block. Then there is the case where there is a default