aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-implitem.h
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-02-09 11:21:39 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-02-09 18:00:00 +0000
commitc598bbbcc1eadb178e74d908ce917b7cf4f556c1 (patch)
tree46d8ef5483a0acc2ee585c8fe176ae7438a5e800 /gcc/rust/backend/rust-compile-implitem.h
parent6d1ff568084ed86e6cf14e709fe6892256be824a (diff)
downloadgcc-c598bbbcc1eadb178e74d908ce917b7cf4f556c1.zip
gcc-c598bbbcc1eadb178e74d908ce917b7cf4f556c1.tar.gz
gcc-c598bbbcc1eadb178e74d908ce917b7cf4f556c1.tar.bz2
Support inline attribute by marking as DECL_DECLARED_INLINE_P
This does a refactor by removing more flags for the fndecl construction from the rust-gcc wrapper code in favour of using the tree api directly. The ABI option attributes have also been refactored from the backend interface in favour of their own package. The gccgo wrapper tried to mark inline fns as extern inline but this refactor allows us to control the inline options specificly for the rust semantics. Fixes #857
Diffstat (limited to 'gcc/rust/backend/rust-compile-implitem.h')
-rw-r--r--gcc/rust/backend/rust-compile-implitem.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h
index d646c83..9320276 100644
--- a/gcc/rust/backend/rust-compile-implitem.h
+++ b/gcc/rust/backend/rust-compile-implitem.h
@@ -133,13 +133,6 @@ public:
// convert to the actual function type
tree compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype);
- unsigned int flags = 0;
-
- // if its the main fn or pub visibility mark its as DECL_PUBLIC
- // please see https://github.com/Rust-GCC/gccrs/pull/137
- if (function.has_visibility ())
- flags |= Backend::function_is_visible;
-
const Resolver::CanonicalPath *canonical_path = nullptr;
bool ok = ctx->get_mappings ()->lookup_canonical_path (
function.get_mappings ().get_crate_num (),
@@ -150,9 +143,13 @@ public:
= canonical_path->get () + fntype->subst_as_string ();
std::string asm_name = ctx->mangle_item (fntype, *canonical_path);
+ unsigned int flags = 0;
tree fndecl
= ctx->get_backend ()->function (compiled_fn_type, ir_symbol_name,
asm_name, flags, function.get_locus ());
+ setup_attributes_on_fndecl (fndecl, false, function.has_visibility (),
+ function.get_qualifiers (),
+ function.get_outer_attrs ());
ctx->insert_function_decl (fntype, fndecl);
// setup the params
@@ -395,9 +392,7 @@ public:
// convert to the actual function type
tree compiled_fn_type = TyTyResolveCompile::compile (ctx, fntype);
-
HIR::TraitFunctionDecl &function = func.get_decl ();
- unsigned int flags = 0;
const Resolver::CanonicalPath *canonical_path = nullptr;
bool ok = ctx->get_mappings ()->lookup_canonical_path (
@@ -408,9 +403,13 @@ public:
std::string fn_identifier = canonical_path->get ();
std::string asm_name = ctx->mangle_item (fntype, *canonical_path);
+ unsigned int flags = 0;
tree fndecl
= ctx->get_backend ()->function (compiled_fn_type, fn_identifier,
asm_name, flags, func.get_locus ());
+ setup_attributes_on_fndecl (fndecl, false, false,
+ func.get_decl ().get_qualifiers (),
+ func.get_outer_attrs ());
ctx->insert_function_decl (fntype, fndecl);
// setup the params