From 02132139efa60954c3f9d5aeb4d87210066b1b58 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Sat, 16 Jan 2021 14:34:06 +0000 Subject: 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. --- gcc/rust/backend/rust-compile-var-decl.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'gcc') 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; }; -- cgit v1.1