aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-var-decl.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-01-16 14:34:06 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-01-17 15:59:36 +0000
commit02132139efa60954c3f9d5aeb4d87210066b1b58 (patch)
treee0a5f0a051560a8f93058113b0e279e862ea34a6 /gcc/rust/backend/rust-compile-var-decl.h
parent659ade1611568da5d91a0d6a2d76871cce658ff7 (diff)
downloadgcc-02132139efa60954c3f9d5aeb4d87210066b1b58.zip
gcc-02132139efa60954c3f9d5aeb4d87210066b1b58.tar.gz
gcc-02132139efa60954c3f9d5aeb4d87210066b1b58.tar.bz2
Fix the naming of VAR_DECLS within gimple nodes.
This was using LetStmt->Pattern.as_string which included mut in the string dump. This makes the gimple nodes harder to debug as the name is (mut a) insteaad of a for example.
Diffstat (limited to 'gcc/rust/backend/rust-compile-var-decl.h')
-rw-r--r--gcc/rust/backend/rust-compile-var-decl.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h
index be3141a..cf73820 100644
--- a/gcc/rust/backend/rust-compile-var-decl.h
+++ b/gcc/rust/backend/rust-compile-var-decl.h
@@ -42,24 +42,33 @@ public:
void visit (HIR::LetStmt &stmt)
{
+ locus = stmt.get_locus ();
TyTy::TyBase *resolved_type = nullptr;
bool ok = ctx->get_tyctx ()->lookup_type (stmt.get_mappings ().get_hirid (),
&resolved_type);
rust_assert (ok);
- ::Btype *translated_type = TyTyResolveCompile::compile (ctx, resolved_type);
+ translated_type = TyTyResolveCompile::compile (ctx, resolved_type);
+ stmt.get_pattern ()->accept_vis (*this);
+ }
- translated = ctx->get_backend ()->local_variable (
- fndecl, stmt.get_pattern ()->as_string (), translated_type,
- NULL /*decl_var*/, false /*address_taken*/, stmt.get_locus ());
+ void visit (HIR::IdentifierPattern &pattern)
+ {
+ translated
+ = ctx->get_backend ()->local_variable (fndecl, pattern.variable_ident,
+ translated_type, NULL /*decl_var*/,
+ false /*address_taken*/, locus);
}
private:
CompileVarDecl (Context *ctx, ::Bfunction *fndecl)
- : HIRCompileBase (ctx), fndecl (fndecl), translated (nullptr)
+ : HIRCompileBase (ctx), fndecl (fndecl), translated_type (nullptr),
+ translated (nullptr)
{}
::Bfunction *fndecl;
+ ::Btype *translated_type;
+ Location locus;
::Bvariable *translated;
};