aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Poulhiès <dkm@kataplop.net>2023-05-28 22:10:35 +0200
committerPhilip Herron <philip.herron@embecosm.com>2023-06-30 17:15:14 +0000
commitd96093d97b5ab84005a2bc615dda953a53f97cd1 (patch)
tree8e1cd0c692be9ea953cadba4e080c6b5ee7c94b7
parent9d3f1985720417f969b1156871e9244a21490e43 (diff)
downloadgcc-d96093d97b5ab84005a2bc615dda953a53f97cd1.zip
gcc-d96093d97b5ab84005a2bc615dda953a53f97cd1.tar.gz
gcc-d96093d97b5ab84005a2bc615dda953a53f97cd1.tar.bz2
gccrs: cleanup getters to return &unique_ptr instead of pointer
Make all getter methods in HIR classes return a unique_ptr reference instead of a pointer and adjust all callers. gcc/rust/ChangeLog: * hir/tree/rust-hir-type.h (ArrayType::get_element_type): Returns unique_ptr. * hir/tree/rust-hir-expr.h (ArithmeticOrLogicalExpr::get_lhs) (ArithmeticOrLogicalExpr::get_rhs): Likewise. (ComparisonExpr::get_lhs, ComparisonExpr::get_rhs): Likewise. (LazyBooleanExpr::get_lhs, LazyBooleanExpr::get_rhs): Likewise. (AssignmentExpr::get_lhs, AssignmentExpr::get_rhs): Likewise. (ArrayExpr::get_internal_elements): Likewise. (ArrayIndexExpr::get_index_expr, ArrayIndexExpr::get_array_expr): Likewise. (StructExprFieldWithVal::get_value): Likewise. (IfExpr::get_if_condition, IfExpr::get_if_block): Likewise. (ExprWithBlock::get_else_block): Likewise. * hir/tree/rust-hir-item.h (FunctionParam::get_param_name) (FunctionParam::get_type): Likewise. (ConstantItem::get_type, ConstantItem::get_expr): Likewise. (StaticItem::get_expr, StaticItem::get_type): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeCheckType::visit): Adjust for previous change. * backend/rust-compile-block.cc (CompileConditionalBlocks::visit): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-item.cc (CompileItem::visit): Likewise. * backend/rust-compile-struct-field-expr.cc (CompileStructExprField::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise. * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise. * typecheck/rust-hir-type-check.cc (TraitItemReference::get_type_from_fn): Likewise. Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
-rw-r--r--gcc/rust/backend/rust-compile-block.cc15
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc28
-rw-r--r--gcc/rust/backend/rust-compile-item.cc4
-rw-r--r--gcc/rust/backend/rust-compile-struct-field-expr.cc4
-rw-r--r--gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc2
-rw-r--r--gcc/rust/hir/tree/rust-hir-expr.h34
-rw-r--r--gcc/rust/hir/tree/rust-hir-item.h12
-rw-r--r--gcc/rust/hir/tree/rust-hir-type.h4
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-expr.cc31
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-implitem.cc14
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-item.cc18
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-stmt.cc5
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-struct.cc4
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-type.cc5
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check.cc9
15 files changed, 100 insertions, 89 deletions
diff --git a/gcc/rust/backend/rust-compile-block.cc b/gcc/rust/backend/rust-compile-block.cc
index 12ef102..55bd4bb 100644
--- a/gcc/rust/backend/rust-compile-block.cc
+++ b/gcc/rust/backend/rust-compile-block.cc
@@ -108,8 +108,10 @@ CompileConditionalBlocks::visit (HIR::IfExpr &expr)
{
fncontext fnctx = ctx->peek_fn ();
tree fndecl = fnctx.fndecl;
- tree condition_expr = CompileExpr::Compile (expr.get_if_condition (), ctx);
- tree then_block = CompileBlock::compile (expr.get_if_block (), ctx, result);
+ tree condition_expr
+ = CompileExpr::Compile (expr.get_if_condition ().get (), ctx);
+ tree then_block
+ = CompileBlock::compile (expr.get_if_block ().get (), ctx, result);
translated
= ctx->get_backend ()->if_statement (fndecl, condition_expr, then_block,
@@ -121,8 +123,10 @@ CompileConditionalBlocks::visit (HIR::IfExprConseqElse &expr)
{
fncontext fnctx = ctx->peek_fn ();
tree fndecl = fnctx.fndecl;
- tree condition_expr = CompileExpr::Compile (expr.get_if_condition (), ctx);
- tree then_block = CompileBlock::compile (expr.get_if_block (), ctx, result);
+ tree condition_expr
+ = CompileExpr::Compile (expr.get_if_condition ().get (), ctx);
+ tree then_block
+ = CompileBlock::compile (expr.get_if_block ().get (), ctx, result);
// else block
std::vector<Bvariable *> locals;
@@ -134,7 +138,8 @@ CompileConditionalBlocks::visit (HIR::IfExprConseqElse &expr)
ctx->push_block (else_block);
tree else_stmt_decl
- = CompileExprWithBlock::compile (expr.get_else_block (), ctx, result);
+ = CompileExprWithBlock::compile (expr.get_else_block ().get (), ctx,
+ result);
ctx->add_statement (else_stmt_decl);
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index e902745..fecd848 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -143,8 +143,8 @@ void
CompileExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
{
auto op = expr.get_expr_type ();
- auto lhs = CompileExpr::Compile (expr.get_lhs (), ctx);
- auto rhs = CompileExpr::Compile (expr.get_rhs (), ctx);
+ auto lhs = CompileExpr::Compile (expr.get_lhs ().get (), ctx);
+ auto rhs = CompileExpr::Compile (expr.get_rhs ().get (), ctx);
// this might be an operator overload situation lets check
TyTy::FnType *fntype;
@@ -155,7 +155,8 @@ CompileExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
auto lang_item_type
= Analysis::RustLangItem::OperatorToLangItem (expr.get_expr_type ());
translated = resolve_operator_overload (lang_item_type, expr, lhs, rhs,
- expr.get_lhs (), expr.get_rhs ());
+ expr.get_lhs ().get (),
+ expr.get_rhs ().get ());
return;
}
@@ -258,8 +259,8 @@ void
CompileExpr::visit (HIR::ComparisonExpr &expr)
{
auto op = expr.get_expr_type ();
- auto lhs = CompileExpr::Compile (expr.get_lhs (), ctx);
- auto rhs = CompileExpr::Compile (expr.get_rhs (), ctx);
+ auto lhs = CompileExpr::Compile (expr.get_lhs ().get (), ctx);
+ auto rhs = CompileExpr::Compile (expr.get_rhs ().get (), ctx);
auto location = expr.get_locus ();
translated
@@ -270,8 +271,8 @@ void
CompileExpr::visit (HIR::LazyBooleanExpr &expr)
{
auto op = expr.get_expr_type ();
- auto lhs = CompileExpr::Compile (expr.get_lhs (), ctx);
- auto rhs = CompileExpr::Compile (expr.get_rhs (), ctx);
+ auto lhs = CompileExpr::Compile (expr.get_lhs ().get (), ctx);
+ auto rhs = CompileExpr::Compile (expr.get_rhs ().get (), ctx);
auto location = expr.get_locus ();
translated
@@ -908,8 +909,8 @@ CompileExpr::visit (HIR::LiteralExpr &expr)
void
CompileExpr::visit (HIR::AssignmentExpr &expr)
{
- auto lvalue = CompileExpr::Compile (expr.get_lhs (), ctx);
- auto rvalue = CompileExpr::Compile (expr.get_rhs (), ctx);
+ auto lvalue = CompileExpr::Compile (expr.get_lhs ().get (), ctx);
+ auto rvalue = CompileExpr::Compile (expr.get_rhs ().get (), ctx);
// assignments are coercion sites so lets convert the rvalue if necessary
TyTy::BaseType *expected = nullptr;
@@ -2553,8 +2554,9 @@ CompileExpr::visit (HIR::RangeFromToInclExpr &expr)
void
CompileExpr::visit (HIR::ArrayIndexExpr &expr)
{
- tree array_reference = CompileExpr::Compile (expr.get_array_expr (), ctx);
- tree index = CompileExpr::Compile (expr.get_index_expr (), ctx);
+ tree array_reference
+ = CompileExpr::Compile (expr.get_array_expr ().get (), ctx);
+ tree index = CompileExpr::Compile (expr.get_index_expr ().get (), ctx);
// this might be an core::ops::index lang item situation
TyTy::FnType *fntype;
@@ -2565,8 +2567,8 @@ CompileExpr::visit (HIR::ArrayIndexExpr &expr)
auto lang_item_type = Analysis::RustLangItem::ItemType::INDEX;
tree operator_overload_call
= resolve_operator_overload (lang_item_type, expr, array_reference,
- index, expr.get_array_expr (),
- expr.get_index_expr ());
+ index, expr.get_array_expr ().get (),
+ expr.get_index_expr ().get ());
tree actual_type = TREE_TYPE (operator_overload_call);
bool can_indirect = TYPE_PTR_P (actual_type) || TYPE_REF_P (actual_type);
diff --git a/gcc/rust/backend/rust-compile-item.cc b/gcc/rust/backend/rust-compile-item.cc
index 49ecb63..ccfd921 100644
--- a/gcc/rust/backend/rust-compile-item.cc
+++ b/gcc/rust/backend/rust-compile-item.cc
@@ -47,7 +47,7 @@ CompileItem::visit (HIR::StaticItem &var)
var.get_mappings ().get_nodeid (), &canonical_path);
rust_assert (ok);
- HIR::Expr *const_value_expr = var.get_expr ();
+ HIR::Expr *const_value_expr = var.get_expr ().get ();
ctx->push_const_context ();
tree value = compile_constant_item (resolved_type, canonical_path,
const_value_expr, var.get_locus ());
@@ -94,7 +94,7 @@ CompileItem::visit (HIR::ConstantItem &constant)
constant.get_mappings ().get_nodeid (), &canonical_path);
rust_assert (ok);
- HIR::Expr *const_value_expr = constant.get_expr ();
+ HIR::Expr *const_value_expr = constant.get_expr ().get ();
ctx->push_const_context ();
tree const_expr
= compile_constant_item (resolved_type, canonical_path, const_value_expr,
diff --git a/gcc/rust/backend/rust-compile-struct-field-expr.cc b/gcc/rust/backend/rust-compile-struct-field-expr.cc
index 1407950..9b12744 100644
--- a/gcc/rust/backend/rust-compile-struct-field-expr.cc
+++ b/gcc/rust/backend/rust-compile-struct-field-expr.cc
@@ -51,13 +51,13 @@ CompileStructExprField::Compile (HIR::StructExprField *field, Context *ctx)
void
CompileStructExprField::visit (HIR::StructExprFieldIdentifierValue &field)
{
- translated = CompileExpr::Compile (field.get_value (), ctx);
+ translated = CompileExpr::Compile (field.get_value ().get (), ctx);
}
void
CompileStructExprField::visit (HIR::StructExprFieldIndexValue &field)
{
- translated = CompileExpr::Compile (field.get_value (), ctx);
+ translated = CompileExpr::Compile (field.get_value ().get (), ctx);
}
void
diff --git a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
index 60bfc22..63fd67d 100644
--- a/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
+++ b/gcc/rust/checks/errors/privacy/rust-privacy-reporter.cc
@@ -608,7 +608,7 @@ void
PrivacyReporter::visit (HIR::Function &function)
{
for (auto &param : function.get_function_params ())
- check_type_privacy (param.get_type ());
+ check_type_privacy (param.get_type ().get ());
function.get_definition ()->accept_vis (*this);
}
diff --git a/gcc/rust/hir/tree/rust-hir-expr.h b/gcc/rust/hir/tree/rust-hir-expr.h
index bf8bc68..421ab23 100644
--- a/gcc/rust/hir/tree/rust-hir-expr.h
+++ b/gcc/rust/hir/tree/rust-hir-expr.h
@@ -387,8 +387,8 @@ public:
void visit_lhs (HIRFullVisitor &vis) { main_or_left_expr->accept_vis (vis); }
void visit_rhs (HIRFullVisitor &vis) { right_expr->accept_vis (vis); }
- Expr *get_lhs () { return main_or_left_expr.get (); }
- Expr *get_rhs () { return right_expr.get (); }
+ std::unique_ptr<Expr> &get_lhs () { return main_or_left_expr; }
+ std::unique_ptr<Expr> &get_rhs () { return right_expr; }
protected:
/* Use covariance to implement clone function as returning this object rather
@@ -459,8 +459,8 @@ public:
void accept_vis (HIRFullVisitor &vis) override;
void accept_vis (HIRExpressionVisitor &vis) override;
- Expr *get_lhs () { return main_or_left_expr.get (); }
- Expr *get_rhs () { return right_expr.get (); }
+ std::unique_ptr<Expr> &get_lhs () { return main_or_left_expr; }
+ std::unique_ptr<Expr> &get_rhs () { return right_expr; }
ExprType get_kind () { return expr_type; }
@@ -533,9 +533,8 @@ public:
void accept_vis (HIRFullVisitor &vis) override;
void accept_vis (HIRExpressionVisitor &vis) override;
- Expr *get_lhs () { return main_or_left_expr.get (); }
-
- Expr *get_rhs () { return right_expr.get (); }
+ std::unique_ptr<Expr> &get_lhs () { return main_or_left_expr; }
+ std::unique_ptr<Expr> &get_rhs () { return right_expr; }
protected:
/* Use covariance to implement clone function as returning this object rather
@@ -667,8 +666,8 @@ public:
void visit_lhs (HIRFullVisitor &vis) { main_or_left_expr->accept_vis (vis); }
void visit_rhs (HIRFullVisitor &vis) { right_expr->accept_vis (vis); }
- Expr *get_lhs () { return main_or_left_expr.get (); }
- Expr *get_rhs () { return right_expr.get (); }
+ std::unique_ptr<Expr> &get_lhs () { return main_or_left_expr; }
+ std::unique_ptr<Expr> &get_rhs () { return right_expr; }
protected:
/* Use covariance to implement clone function as returning this object rather
@@ -1039,7 +1038,10 @@ public:
void accept_vis (HIRFullVisitor &vis) override;
void accept_vis (HIRExpressionVisitor &vis) override;
- ArrayElems *get_internal_elements () { return internal_elements.get (); };
+ std::unique_ptr<ArrayElems> &get_internal_elements ()
+ {
+ return internal_elements;
+ };
ExprType get_expression_type () const override final
{
@@ -1105,8 +1107,8 @@ public:
void accept_vis (HIRFullVisitor &vis) override;
void accept_vis (HIRExpressionVisitor &vis) override;
- Expr *get_array_expr () { return array_expr.get (); }
- Expr *get_index_expr () { return index_expr.get (); }
+ std::unique_ptr<Expr> &get_array_expr () { return array_expr; }
+ std::unique_ptr<Expr> &get_index_expr () { return index_expr; }
ExprType get_expression_type () const override final
{
@@ -1516,7 +1518,7 @@ protected:
public:
std::string as_string () const override;
- Expr *get_value () { return value.get (); }
+ std::unique_ptr<Expr> &get_value () { return value; }
};
// Identifier and value variant of StructExprField HIR node
@@ -3252,8 +3254,8 @@ public:
void vis_if_condition (HIRFullVisitor &vis) { condition->accept_vis (vis); }
void vis_if_block (HIRFullVisitor &vis) { if_block->accept_vis (vis); }
- Expr *get_if_condition () { return condition.get (); }
- BlockExpr *get_if_block () { return if_block.get (); }
+ std::unique_ptr<Expr> &get_if_condition () { return condition; }
+ std::unique_ptr<BlockExpr> &get_if_block () { return if_block; }
ExprType get_expression_type () const final override { return ExprType::If; }
@@ -3316,7 +3318,7 @@ public:
void vis_else_block (HIRFullVisitor &vis) { else_block->accept_vis (vis); }
- ExprWithBlock *get_else_block () { return else_block.get (); }
+ std::unique_ptr<ExprWithBlock> &get_else_block () { return else_block; }
protected:
/* Use covariance to implement clone function as returning this object rather
diff --git a/gcc/rust/hir/tree/rust-hir-item.h b/gcc/rust/hir/tree/rust-hir-item.h
index 8fdfa5f..8932c55 100644
--- a/gcc/rust/hir/tree/rust-hir-item.h
+++ b/gcc/rust/hir/tree/rust-hir-item.h
@@ -551,9 +551,9 @@ public:
Location get_locus () const { return locus; }
- Pattern *get_param_name () { return param_name.get (); }
+ std::unique_ptr<Pattern> &get_param_name () { return param_name; }
- Type *get_type () { return type.get (); }
+ std::unique_ptr<Type> &get_type () { return type; }
const Analysis::NodeMapping &get_mappings () const { return mappings; }
};
@@ -2129,9 +2129,9 @@ public:
void accept_vis (HIRImplVisitor &vis) override;
void accept_vis (HIRVisItemVisitor &vis) override;
- Type *get_type () { return type.get (); }
+ std::unique_ptr<Type> &get_type () { return type; }
- Expr *get_expr () { return const_expr.get (); }
+ std::unique_ptr<Expr> &get_expr () { return const_expr; }
Identifier get_identifier () const { return identifier; }
@@ -2225,9 +2225,9 @@ public:
bool is_mut () const { return mut == Mutability::Mut; }
- Expr *get_expr () { return expr.get (); }
+ std::unique_ptr<Expr> &get_expr () { return expr; }
- Type *get_type () { return type.get (); }
+ std::unique_ptr<Type> &get_type () { return type; }
ItemKind get_item_kind () const override { return ItemKind::Static; }
diff --git a/gcc/rust/hir/tree/rust-hir-type.h b/gcc/rust/hir/tree/rust-hir-type.h
index 2e7df10..8f09896 100644
--- a/gcc/rust/hir/tree/rust-hir-type.h
+++ b/gcc/rust/hir/tree/rust-hir-type.h
@@ -570,9 +570,9 @@ public:
void accept_vis (HIRFullVisitor &vis) override;
void accept_vis (HIRTypeVisitor &vis) override;
- Type *get_element_type () { return elem_type.get (); }
+ std::unique_ptr<Type> &get_element_type () { return elem_type; }
- Expr *get_size_expr () { return size.get (); }
+ std::unique_ptr<Expr> &get_size_expr () { return size; }
protected:
/* Use covariance to implement clone function as returning this object rather
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index ef1e0ac..d0b1ce6 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -224,8 +224,8 @@ TypeCheckExpr::visit (HIR::AssignmentExpr &expr)
{
infered = TyTy::TupleType::get_unit_type (expr.get_mappings ().get_hirid ());
- auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ());
- auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ());
+ auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ().get ());
+ auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ().get ());
coercion_site (expr.get_mappings ().get_hirid (),
TyTy::TyWithLocation (lhs, expr.get_lhs ()->get_locus ()),
@@ -280,8 +280,8 @@ TypeCheckExpr::visit (HIR::LiteralExpr &expr)
void
TypeCheckExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
{
- auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ());
- auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ());
+ auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ().get ());
+ auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ().get ());
auto lang_item_type
= Analysis::RustLangItem::OperatorToLangItem (expr.get_expr_type ());
@@ -326,8 +326,8 @@ TypeCheckExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
void
TypeCheckExpr::visit (HIR::ComparisonExpr &expr)
{
- auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ());
- auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ());
+ auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ().get ());
+ auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ().get ());
unify_site (expr.get_mappings ().get_hirid (),
TyTy::TyWithLocation (lhs, expr.get_lhs ()->get_locus ()),
@@ -341,8 +341,8 @@ TypeCheckExpr::visit (HIR::ComparisonExpr &expr)
void
TypeCheckExpr::visit (HIR::LazyBooleanExpr &expr)
{
- auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ());
- auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ());
+ auto lhs = TypeCheckExpr::Resolve (expr.get_lhs ().get ());
+ auto rhs = TypeCheckExpr::Resolve (expr.get_rhs ().get ());
// we expect the lhs and rhs must be bools at this point
TyTy::BaseType *boolean_node = nullptr;
@@ -433,8 +433,8 @@ TypeCheckExpr::visit (HIR::NegationExpr &expr)
void
TypeCheckExpr::visit (HIR::IfExpr &expr)
{
- TypeCheckExpr::Resolve (expr.get_if_condition ());
- TypeCheckExpr::Resolve (expr.get_if_block ());
+ TypeCheckExpr::Resolve (expr.get_if_condition ().get ());
+ TypeCheckExpr::Resolve (expr.get_if_block ().get ());
infered = TyTy::TupleType::get_unit_type (expr.get_mappings ().get_hirid ());
}
@@ -442,9 +442,10 @@ TypeCheckExpr::visit (HIR::IfExpr &expr)
void
TypeCheckExpr::visit (HIR::IfExprConseqElse &expr)
{
- TypeCheckExpr::Resolve (expr.get_if_condition ());
- auto if_blk_resolved = TypeCheckExpr::Resolve (expr.get_if_block ());
- auto else_blk_resolved = TypeCheckExpr::Resolve (expr.get_else_block ());
+ TypeCheckExpr::Resolve (expr.get_if_condition ().get ());
+ auto if_blk_resolved = TypeCheckExpr::Resolve (expr.get_if_block ().get ());
+ auto else_blk_resolved
+ = TypeCheckExpr::Resolve (expr.get_else_block ().get ());
if (if_blk_resolved->get_kind () == TyTy::NEVER)
infered = else_blk_resolved;
@@ -808,11 +809,11 @@ TypeCheckExpr::visit (HIR::RangeFromToInclExpr &expr)
void
TypeCheckExpr::visit (HIR::ArrayIndexExpr &expr)
{
- auto array_expr_ty = TypeCheckExpr::Resolve (expr.get_array_expr ());
+ auto array_expr_ty = TypeCheckExpr::Resolve (expr.get_array_expr ().get ());
if (array_expr_ty->get_kind () == TyTy::TypeKind::ERROR)
return;
- auto index_expr_ty = TypeCheckExpr::Resolve (expr.get_index_expr ());
+ auto index_expr_ty = TypeCheckExpr::Resolve (expr.get_index_expr ().get ());
if (index_expr_ty->get_kind () == TyTy::TypeKind::ERROR)
return;
diff --git a/gcc/rust/typecheck/rust-hir-type-check-implitem.cc b/gcc/rust/typecheck/rust-hir-type-check-implitem.cc
index 62d8a88..2631f48 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-implitem.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-implitem.cc
@@ -271,13 +271,12 @@ TypeCheckImplItem::visit (HIR::Function &function)
for (auto &param : function.get_function_params ())
{
// get the name as well required for later on
- auto param_tyty = TypeCheckType::Resolve (param.get_type ());
- params.push_back (
- std::pair<HIR::Pattern *, TyTy::BaseType *> (param.get_param_name (),
- param_tyty));
+ auto param_tyty = TypeCheckType::Resolve (param.get_type ().get ());
+ params.push_back (std::pair<HIR::Pattern *, TyTy::BaseType *> (
+ param.get_param_name ().get (), param_tyty));
context->insert_type (param.get_mappings (), param_tyty);
- TypeCheckPattern::Resolve (param.get_param_name (), param_tyty);
+ TypeCheckPattern::Resolve (param.get_param_name ().get (), param_tyty);
}
const CanonicalPath *canonical_path = nullptr;
@@ -324,8 +323,9 @@ TypeCheckImplItem::visit (HIR::Function &function)
void
TypeCheckImplItem::visit (HIR::ConstantItem &constant)
{
- TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ());
- TyTy::BaseType *expr_type = TypeCheckExpr::Resolve (constant.get_expr ());
+ TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ().get ());
+ TyTy::BaseType *expr_type
+ = TypeCheckExpr::Resolve (constant.get_expr ().get ());
TyTy::BaseType *unified = unify_site (
constant.get_mappings ().get_hirid (),
diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.cc b/gcc/rust/typecheck/rust-hir-type-check-item.cc
index 767d24d..bb8a5eb 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-item.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc
@@ -355,8 +355,8 @@ TypeCheckItem::visit (HIR::Union &union_decl)
void
TypeCheckItem::visit (HIR::StaticItem &var)
{
- TyTy::BaseType *type = TypeCheckType::Resolve (var.get_type ());
- TyTy::BaseType *expr_type = TypeCheckExpr::Resolve (var.get_expr ());
+ TyTy::BaseType *type = TypeCheckType::Resolve (var.get_type ().get ());
+ TyTy::BaseType *expr_type = TypeCheckExpr::Resolve (var.get_expr ().get ());
TyTy::BaseType *unified
= coercion_site (var.get_mappings ().get_hirid (),
@@ -371,8 +371,9 @@ TypeCheckItem::visit (HIR::StaticItem &var)
void
TypeCheckItem::visit (HIR::ConstantItem &constant)
{
- TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ());
- TyTy::BaseType *expr_type = TypeCheckExpr::Resolve (constant.get_expr ());
+ TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ().get ());
+ TyTy::BaseType *expr_type
+ = TypeCheckExpr::Resolve (constant.get_expr ().get ());
TyTy::BaseType *unified = unify_site (
constant.get_mappings ().get_hirid (),
@@ -461,13 +462,12 @@ TypeCheckItem::visit (HIR::Function &function)
for (auto &param : function.get_function_params ())
{
// get the name as well required for later on
- auto param_tyty = TypeCheckType::Resolve (param.get_type ());
- params.push_back (
- std::pair<HIR::Pattern *, TyTy::BaseType *> (param.get_param_name (),
- param_tyty));
+ auto param_tyty = TypeCheckType::Resolve (param.get_type ().get ());
+ params.push_back (std::pair<HIR::Pattern *, TyTy::BaseType *> (
+ param.get_param_name ().get (), param_tyty));
context->insert_type (param.get_mappings (), param_tyty);
- TypeCheckPattern::Resolve (param.get_param_name (), param_tyty);
+ TypeCheckPattern::Resolve (param.get_param_name ().get (), param_tyty);
}
const CanonicalPath *canonical_path = nullptr;
diff --git a/gcc/rust/typecheck/rust-hir-type-check-stmt.cc b/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
index 18df2e5..f6af332 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
@@ -59,8 +59,9 @@ TypeCheckStmt::visit (HIR::ExternBlock &extern_block)
void
TypeCheckStmt::visit (HIR::ConstantItem &constant)
{
- TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ());
- TyTy::BaseType *expr_type = TypeCheckExpr::Resolve (constant.get_expr ());
+ TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ().get ());
+ TyTy::BaseType *expr_type
+ = TypeCheckExpr::Resolve (constant.get_expr ().get ());
infered = coercion_site (
constant.get_mappings ().get_hirid (),
diff --git a/gcc/rust/typecheck/rust-hir-type-check-struct.cc b/gcc/rust/typecheck/rust-hir-type-check-struct.cc
index a9d03e1..ce11e72 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-struct.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-struct.cc
@@ -258,7 +258,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifierValue &field)
return;
}
- TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ());
+ TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ().get ());
Location value_locus = field.get_value ()->get_locus ();
HirId coercion_site_id = field.get_mappings ().get_hirid ();
@@ -295,7 +295,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIndexValue &field)
return;
}
- TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ());
+ TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ().get ());
Location value_locus = field.get_value ()->get_locus ();
HirId coercion_site_id = field.get_mappings ().get_hirid ();
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc
index d5c910b..5ddcb15 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc
@@ -604,7 +604,7 @@ TypeCheckType::visit (HIR::TraitObjectType &type)
void
TypeCheckType::visit (HIR::ArrayType &type)
{
- auto capacity_type = TypeCheckExpr::Resolve (type.get_size_expr ());
+ auto capacity_type = TypeCheckExpr::Resolve (type.get_size_expr ().get ());
if (capacity_type->get_kind () == TyTy::TypeKind::ERROR)
return;
@@ -619,7 +619,8 @@ TypeCheckType::visit (HIR::ArrayType &type)
type.get_size_expr ()->get_locus ()),
type.get_size_expr ()->get_locus ());
- TyTy::BaseType *base = TypeCheckType::Resolve (type.get_element_type ());
+ TyTy::BaseType *base
+ = TypeCheckType::Resolve (type.get_element_type ().get ());
translated = new TyTy::ArrayType (type.get_mappings ().get_hirid (),
type.get_locus (), *type.get_size_expr (),
TyTy::TyVar (base->get_ref ()));
diff --git a/gcc/rust/typecheck/rust-hir-type-check.cc b/gcc/rust/typecheck/rust-hir-type-check.cc
index 5ce7bc6..f98f750 100644
--- a/gcc/rust/typecheck/rust-hir-type-check.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check.cc
@@ -259,13 +259,12 @@ TraitItemReference::get_type_from_fn (/*const*/ HIR::TraitItemFunc &fn) const
for (auto &param : function.get_function_params ())
{
// get the name as well required for later on
- auto param_tyty = TypeCheckType::Resolve (param.get_type ());
- params.push_back (
- std::pair<HIR::Pattern *, TyTy::BaseType *> (param.get_param_name (),
- param_tyty));
+ auto param_tyty = TypeCheckType::Resolve (param.get_type ().get ());
+ params.push_back (std::pair<HIR::Pattern *, TyTy::BaseType *> (
+ param.get_param_name ().get (), param_tyty));
context->insert_type (param.get_mappings (), param_tyty);
- TypeCheckPattern::Resolve (param.get_param_name (), param_tyty);
+ TypeCheckPattern::Resolve (param.get_param_name ().get (), param_tyty);
}
auto mappings = Analysis::Mappings::get ();