diff options
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 6 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.h | 8 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-implitem.h | 9 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-intrinsic.cc | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 3 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.cc | 14 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.h | 2 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-var-decl.h | 3 |
8 files changed, 21 insertions, 26 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index ab560e8..a592e35 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -205,7 +205,7 @@ CompileExpr::visit (HIR::MatchExpr &expr) expr.get_scrutinee_expr ()->get_mappings ().get_hirid (), &scrutinee_expr_tyty)) { - translated = ctx->get_backend ()->error_expression (); + translated = error_mark_node; return; } @@ -221,7 +221,7 @@ CompileExpr::visit (HIR::MatchExpr &expr) if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (), &expr_tyty)) { - translated = ctx->get_backend ()->error_expression (); + translated = error_mark_node; return; } @@ -644,7 +644,7 @@ CompileExpr::compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn, } if (ref == nullptr) - return ctx->get_backend ()->error_expression (); + return error_mark_node; // get any indirection sorted out if (receiver->get_kind () == TyTy::TypeKind::REF) diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h index 592d280..2fee3be 100644 --- a/gcc/rust/backend/rust-compile-expr.h +++ b/gcc/rust/backend/rust-compile-expr.h @@ -383,8 +383,8 @@ public: ctx->add_statement (ret_var_stmt); } - auto code_block = CompileBlock::compile (&expr, ctx, tmp); - auto block_stmt = ctx->get_backend ()->block_statement (code_block); + auto block_stmt = CompileBlock::compile (&expr, ctx, tmp); + rust_assert (TREE_CODE (block_stmt) == BIND_EXPR); ctx->add_statement (block_stmt); if (tmp != NULL) @@ -680,9 +680,9 @@ public: = ctx->get_backend ()->expression_statement (fnctx.fndecl, exit_expr); ctx->add_statement (break_stmt); - tree code_block + tree code_block_stmt = CompileBlock::compile (expr.get_loop_block ().get (), ctx, nullptr); - tree code_block_stmt = ctx->get_backend ()->block_statement (code_block); + rust_assert (TREE_CODE (code_block_stmt) == BIND_EXPR); ctx->add_statement (code_block_stmt); ctx->pop_loop_begin_label (); diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h index 60b7246..4d49c0b 100644 --- a/gcc/rust/backend/rust-compile-implitem.h +++ b/gcc/rust/backend/rust-compile-implitem.h @@ -40,8 +40,7 @@ public: CompileInherentImplItem compiler (ctx, concrete, ref_locus); item->accept_vis (compiler); - if (is_query_mode - && ctx->get_backend ()->is_error_expression (compiler.reference)) + if (is_query_mode && compiler.reference == error_mark_node) rust_internal_error_at (ref_locus, "failed to compile impl item: %s", item->as_string ().c_str ()); @@ -67,8 +66,7 @@ public: CompileTraitItem compiler (ctx, concrete, ref_locus); item->accept_vis (compiler); - if (is_query_mode - && ctx->get_backend ()->is_error_expression (compiler.reference)) + if (is_query_mode && compiler.reference == error_mark_node) rust_internal_error_at (ref_locus, "failed to compile trait item: %s", item->as_string ().c_str ()); @@ -81,8 +79,7 @@ public: private: CompileTraitItem (Context *ctx, TyTy::BaseType *concrete, Location ref_locus) - : HIRCompileBase (ctx), concrete (concrete), - reference (ctx->get_backend ()->error_expression ()), + : HIRCompileBase (ctx), concrete (concrete), reference (error_mark_node), ref_locus (ref_locus) {} diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc b/gcc/rust/backend/rust-compile-intrinsic.cc index 69626a9..8c5b073 100644 --- a/gcc/rust/backend/rust-compile-intrinsic.cc +++ b/gcc/rust/backend/rust-compile-intrinsic.cc @@ -85,7 +85,7 @@ Intrinsics::compile (TyTy::FnType *fntype) Location locus = ctx->get_mappings ()->lookup_location (fntype->get_ref ()); rust_error_at (locus, "unknown builtin"); - return ctx->get_backend ()->error_function (); + return error_mark_node; } } // namespace Compile diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index 71f259f..897fe85 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -38,8 +38,7 @@ public: CompileItem compiler (ctx, concrete, ref_locus); item->accept_vis (compiler); - if (is_query_mode - && ctx->get_backend ()->is_error_expression (compiler.reference)) + if (is_query_mode && compiler.reference == error_mark_node) rust_internal_error_at (ref_locus, "failed to compile item: %s", item->as_string ().c_str ()); diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index 2ef1232..e41ee7f 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -58,7 +58,7 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment, if (!ctx->get_resolver ()->lookup_definition (ref_node_id, &def)) { rust_error_at (expr_locus, "unknown reference for resolved name"); - return ctx->get_backend ()->error_expression (); + return error_mark_node; } ref_node_id = def.parent; } @@ -69,22 +69,22 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment, { // it might be an enum data-less enum variant if (lookup->get_kind () != TyTy::TypeKind::ADT) - return ctx->get_backend ()->error_expression (); + return error_mark_node; TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (lookup); if (!adt->is_enum ()) - return ctx->get_backend ()->error_expression (); + return error_mark_node; HirId variant_id; if (!ctx->get_tyctx ()->lookup_variant_definition (mappings.get_hirid (), &variant_id)) - return ctx->get_backend ()->error_expression (); + return error_mark_node; int union_disriminator = -1; TyTy::VariantDef *variant = nullptr; if (!adt->lookup_variant_by_id (variant_id, &variant, &union_disriminator)) - return ctx->get_backend ()->error_expression (); + return error_mark_node; // this can only be for discriminant variants the others are built up // using call-expr or struct-init @@ -111,7 +111,7 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment, ref_node_id, &ref)) { rust_error_at (expr_locus, "reverse call path lookup failure"); - return ctx->get_backend ()->error_expression (); + return error_mark_node; } // might be a constant @@ -274,7 +274,7 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup, } } - return ctx->get_backend ()->error_expression (); + return error_mark_node; } } // namespace Compile diff --git a/gcc/rust/backend/rust-compile-resolve-path.h b/gcc/rust/backend/rust-compile-resolve-path.h index b4161cb..9c9d7c5 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.h +++ b/gcc/rust/backend/rust-compile-resolve-path.h @@ -50,7 +50,7 @@ public: private: ResolvePathRef (Context *ctx) - : HIRCompileBase (ctx), resolved (ctx->get_backend ()->error_expression ()) + : HIRCompileBase (ctx), resolved (error_mark_node) {} tree resolve (const HIR::PathIdentSegment &final_segment, diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h index 7bc37eb..c431edd 100644 --- a/gcc/rust/backend/rust-compile-var-decl.h +++ b/gcc/rust/backend/rust-compile-var-decl.h @@ -72,8 +72,7 @@ public: private: CompileVarDecl (Context *ctx, tree fndecl) - : HIRCompileBase (ctx), fndecl (fndecl), - translated_type (ctx->get_backend ()->error_type ()), + : HIRCompileBase (ctx), fndecl (fndecl), translated_type (error_mark_node), compiled_variable (ctx->get_backend ()->error_variable ()) {} |