From 94e53f8e55e93da8db3d948c3f16d23b7c4ba7a6 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Wed, 3 Aug 2022 11:54:54 +0100 Subject: Refactor indirect_expression from the gcc-backend wrapper This brings out the indirect expression out of our gcc wrapper, it also just simplifies down to the normal build_indirect_expr_loc calls. Which does not require specifiying the type since we can reuse TREE_TYPE. This also simplifies the address_expression to just address_expr_with_loc and grabs the type from TREE_TYPE as well. --- gcc/rust/backend/rust-compile-resolve-path.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc/rust/backend/rust-compile-resolve-path.cc') diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index b5bfa3c..8c1b7ef 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -129,16 +129,14 @@ ResolvePathRef::resolve (const HIR::PathIdentSegment &final_segment, if (ctx->lookup_function_decl (fntype->get_ty_ref (), &fn)) { TREE_USED (fn) = 1; - return address_expression (fn, build_pointer_type (TREE_TYPE (fn)), - expr_locus); + return address_expression (fn, expr_locus); } else if (fntype->get_abi () == ABI::INTRINSIC) { Intrinsics compile (ctx); fn = compile.compile (fntype); TREE_USED (fn) = 1; - return address_expression (fn, build_pointer_type (TREE_TYPE (fn)), - expr_locus); + return address_expression (fn, expr_locus); } } -- cgit v1.1