aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-03-04 11:30:52 +0000
committerGitHub <noreply@github.com>2022-03-04 11:30:52 +0000
commitb4bd389c66a3e3bf0489626a1a70c2500d415ef8 (patch)
treeb9fbe9d56d8d2220768c3bbf104de4a1f4dc8e26 /gcc/rust/backend
parente35da26d8ed884b27050c6cbfe2460696e4c9ebe (diff)
parent3f2d5a720b2be5b75eab2aa56af0b48a9bae5f62 (diff)
downloadgcc-b4bd389c66a3e3bf0489626a1a70c2500d415ef8.zip
gcc-b4bd389c66a3e3bf0489626a1a70c2500d415ef8.tar.gz
gcc-b4bd389c66a3e3bf0489626a1a70c2500d415ef8.tar.bz2
Merge #984
984: Implimented Soluion 1 and solution 2 for issue_734 r=philberty a=mvvsmk Fixes #734 Done : - [x] Remove iterate_params function - [x] Create new get_params function Solution 1 1) Created a new get_params function which returns the parameters. 2) Changed the references of the iterate_params to use get_params. Solution 2 1) Added get_params2 which returns `std::vector<TyTy::BaseType*>` 2) Changed the references of the iterate_params to use get_params. Status : Currently I have implemented the first solution. Signed-off-by : M V V S Manoj Kumar <mvvsmanojkumar@gmail.com> Co-authored-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-type.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/rust/backend/rust-compile-type.cc b/gcc/rust/backend/rust-compile-type.cc
index 21da9af..ba6a206 100644
--- a/gcc/rust/backend/rust-compile-type.cc
+++ b/gcc/rust/backend/rust-compile-type.cc
@@ -148,11 +148,13 @@ TyTyResolveCompile::visit (const TyTy::FnPtr &type)
tree result_type = TyTyResolveCompile::compile (ctx, type.get_return_type ());
std::vector<tree> parameters;
- type.iterate_params ([&] (TyTy::BaseType *p) mutable -> bool {
- tree pty = TyTyResolveCompile::compile (ctx, p);
- parameters.push_back (pty);
- return true;
- });
+
+ auto &params = type.get_params ();
+ for (auto &p : params)
+ {
+ tree pty = TyTyResolveCompile::compile (ctx, p.get_tyty ());
+ parameters.push_back (pty);
+ }
translated = ctx->get_backend ()->function_ptr_type (result_type, parameters,
type.get_ident ().locus);