aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-item.cc
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-09-04 16:13:31 -0400
committerPhilip Herron <philip.herron@embecosm.com>2023-09-07 20:48:58 +0000
commit8da5a49a0ee5842c4abd0b079ee837290c420814 (patch)
tree603b90ce560d4a91e5e9196f499a8274faa91e07 /gcc/rust/backend/rust-compile-item.cc
parentb6284bd9ff6f54136e6a88c261546a2b6ff12572 (diff)
downloadgcc-8da5a49a0ee5842c4abd0b079ee837290c420814.zip
gcc-8da5a49a0ee5842c4abd0b079ee837290c420814.tar.gz
gcc-8da5a49a0ee5842c4abd0b079ee837290c420814.tar.bz2
Convert class Backend into namespace
gcc/rust/ChangeLog: * rust-backend.h (class Backend): Convert to ... (namespace Backend): ... namespace. * rust-gcc.cc (Backend::Backend): Rename to ... (Backend::init): ... here. (rust_get_backend): Remove. * rust-session-manager.cc (rust_get_backend): Remove. (Session::init): Use Backend::init instead of rust_get_backend. (Session::compile_crate): Initialize Context without pointer to Backend. * rust-session-manager.h (Session::backend): Remove. * backend/rust-compile-context.cc (Context::Context): Remove pointer to Backend. * backend/rust-compile-context.h (class Context): Remove pointer to Backend, update function calls. * backend/rust-compile-base.cc: Update function calls. * backend/rust-compile-block.cc: Likewise. * backend/rust-compile-expr.cc: Likewise. * backend/rust-compile-extern.h: Likewise. * backend/rust-compile-fnparam.cc: Likewise. * backend/rust-compile-intrinsic.cc: Likewise. * backend/rust-compile-item.cc: Likewise. * backend/rust-compile-pattern.cc: Likewise. * backend/rust-compile-resolve-path.cc: Likewise. * backend/rust-compile-type.cc: Likewise. * backend/rust-compile-var-decl.h: Likewise. * backend/rust-compile.cc: Likewise. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.cc')
-rw-r--r--gcc/rust/backend/rust-compile-item.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/rust/backend/rust-compile-item.cc b/gcc/rust/backend/rust-compile-item.cc
index ccfd921..e9f73ea 100644
--- a/gcc/rust/backend/rust-compile-item.cc
+++ b/gcc/rust/backend/rust-compile-item.cc
@@ -30,8 +30,7 @@ CompileItem::visit (HIR::StaticItem &var)
Bvariable *static_decl_ref = nullptr;
if (ctx->lookup_var_decl (var.get_mappings ().get_hirid (), &static_decl_ref))
{
- reference
- = ctx->get_backend ()->var_expression (static_decl_ref, ref_locus);
+ reference = Backend::var_expression (static_decl_ref, ref_locus);
return;
}
@@ -61,17 +60,16 @@ CompileItem::visit (HIR::StaticItem &var)
bool in_unique_section = true;
Bvariable *static_global
- = ctx->get_backend ()->global_variable (name, asm_name, type, is_external,
- is_hidden, in_unique_section,
- var.get_locus ());
+ = Backend::global_variable (name, asm_name, type, is_external, is_hidden,
+ in_unique_section, var.get_locus ());
tree init = value == error_mark_node ? error_mark_node : DECL_INITIAL (value);
- ctx->get_backend ()->global_variable_set_init (static_global, init);
+ Backend::global_variable_set_init (static_global, init);
ctx->insert_var_decl (var.get_mappings ().get_hirid (), static_global);
ctx->push_var (static_global);
- reference = ctx->get_backend ()->var_expression (static_global, ref_locus);
+ reference = Backend::var_expression (static_global, ref_locus);
}
void