aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-var-decl.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-02-10 15:40:23 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-02-10 15:40:55 +0000
commit859732e4d167dfe83b29cebc757f21ba2c342f33 (patch)
tree2616a6c1fdc52ae274b836a055e710f19bc59ffb /gcc/rust/backend/rust-compile-var-decl.h
parentf6ba472caf42db1f5f2f98b73afccf448b36c322 (diff)
downloadgcc-859732e4d167dfe83b29cebc757f21ba2c342f33.zip
gcc-859732e4d167dfe83b29cebc757f21ba2c342f33.tar.gz
gcc-859732e4d167dfe83b29cebc757f21ba2c342f33.tar.bz2
Remove AddressTakenContext
We can reuse more C front-end code c_mark_addressable can be used instead of trying to track TREE_ADDRESSABLE as part of type-checking. This also pulls the GCC::Backend::address_expression to be part of the HIRCompileBase class during code-generation.
Diffstat (limited to 'gcc/rust/backend/rust-compile-var-decl.h')
-rw-r--r--gcc/rust/backend/rust-compile-var-decl.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h
index 48becfa..1da6cd4 100644
--- a/gcc/rust/backend/rust-compile-var-decl.h
+++ b/gcc/rust/backend/rust-compile-var-decl.h
@@ -20,7 +20,6 @@
#define RUST_COMPILE_VAR_DECL
#include "rust-compile-base.h"
-#include "rust-hir-address-taken.h"
namespace Rust {
namespace Compile {
@@ -47,9 +46,6 @@ public:
&resolved_type);
rust_assert (ok);
- address_taken_context->lookup_addess_taken (
- stmt.get_mappings ().get_hirid (), &address_taken);
-
translated_type = TyTyResolveCompile::compile (ctx, resolved_type);
stmt.get_pattern ()->accept_vis (*this);
}
@@ -59,6 +55,9 @@ public:
if (!pattern.is_mut ())
translated_type = ctx->get_backend ()->immutable_type (translated_type);
+ // this gets updated when the compilation _actually_ wants to take an
+ // address
+ bool address_taken = false;
compiled_variable
= ctx->get_backend ()->local_variable (fndecl, pattern.get_identifier (),
translated_type, NULL /*decl_var*/,
@@ -68,6 +67,10 @@ public:
void visit (HIR::WildcardPattern &pattern) override
{
translated_type = ctx->get_backend ()->immutable_type (translated_type);
+
+ // this gets updated when the compilation _actually_ wants to take an
+ // address
+ bool address_taken = false;
compiled_variable
= ctx->get_backend ()->local_variable (fndecl, "_", translated_type,
NULL /*decl_var*/, address_taken,
@@ -78,17 +81,13 @@ private:
CompileVarDecl (Context *ctx, tree fndecl)
: HIRCompileBase (ctx), fndecl (fndecl),
translated_type (ctx->get_backend ()->error_type ()),
- compiled_variable (ctx->get_backend ()->error_variable ()),
- address_taken (false),
- address_taken_context (Resolver::AddressTakenContext::get ())
+ compiled_variable (ctx->get_backend ()->error_variable ())
{}
tree fndecl;
tree translated_type;
Location locus;
Bvariable *compiled_variable;
- bool address_taken;
- const Resolver::AddressTakenContext *address_taken_context;
};
} // namespace Compile