aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-expr.h
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2021-10-07 09:42:50 -0700
committerDavid Faust <david.faust@oracle.com>2021-10-11 10:46:40 -0700
commit85338a7f1ca9bc6d62ea3eb3e0c796b31a58bbbe (patch)
tree2aa14109077705bcfefb2fc8736ce6d1fd865929 /gcc/rust/backend/rust-compile-expr.h
parent99c28309d3553346d4f0337dbae49f4a8e48da01 (diff)
downloadgcc-85338a7f1ca9bc6d62ea3eb3e0c796b31a58bbbe.zip
gcc-85338a7f1ca9bc6d62ea3eb3e0c796b31a58bbbe.tar.gz
gcc-85338a7f1ca9bc6d62ea3eb3e0c796b31a58bbbe.tar.bz2
Remove lambda iterators in various HIR classes
This patch removes the lambda iterators used in various HIR objects. These iterators make interacting with the IR for static analysis more difficult. Instead, get_X () helpers are added for accessing elements, and uses of the iterators replaced with for loops. The following objects are adjusted in this patch: - HIR::ArrayElemsValues - HIR::TupleExpr - HIR::StructExprField - HIR::StructStruct - HIR::TupleStruct Fixes: #703, #704, #705, #706, #707
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.h')
-rw-r--r--gcc/rust/backend/rust-compile-expr.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index eb245dc..7c40466 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -412,11 +412,11 @@ public:
void visit (HIR::ArrayElemsValues &elems) override
{
- elems.iterate ([&] (HIR::Expr *e) mutable -> bool {
- Bexpression *translated_expr = CompileExpr::Compile (e, ctx);
- constructor.push_back (translated_expr);
- return true;
- });
+ for (auto &elem : elems.get_values ())
+ {
+ Bexpression *translated_expr = CompileExpr::Compile (elem.get (), ctx);
+ constructor.push_back (translated_expr);
+ }
}
void visit (HIR::ArrayElemsCopied &elems) override
@@ -646,11 +646,11 @@ public:
// this assumes all fields are in order from type resolution and if a base
// struct was specified those fields are filed via accesors
std::vector<Bexpression *> vals;
- struct_expr.iterate ([&] (HIR::StructExprField *field) mutable -> bool {
- Bexpression *expr = CompileStructExprField::Compile (field, ctx);
- vals.push_back (expr);
- return true;
- });
+ for (auto &field : struct_expr.get_fields ())
+ {
+ Bexpression *expr = CompileStructExprField::Compile (field.get (), ctx);
+ vals.push_back (expr);
+ }
translated
= ctx->get_backend ()->constructor_expression (type, vals,