aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-11-25 14:24:21 +0100
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-11-27 15:33:38 +0000
commit79e4295018dcd65d0d8d9083795c169c5802e013 (patch)
treec4f6b3d8eda07f99f832617e3547700e3ef38227 /gcc/rust
parent8d401933dd2201f89e9ade61a88fa7773c662c35 (diff)
downloadgcc-79e4295018dcd65d0d8d9083795c169c5802e013.zip
gcc-79e4295018dcd65d0d8d9083795c169c5802e013.tar.gz
gcc-79e4295018dcd65d0d8d9083795c169c5802e013.tar.bz2
Prepend crate name to functions with nr2
gcc/rust/ChangeLog: * backend/rust-compile-base.cc: Prepend crate name to function's ir name. gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: Remove passing tests from exclude list. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r--gcc/rust/backend/rust-compile-base.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc
index d272374..e39c2a9 100644
--- a/gcc/rust/backend/rust-compile-base.cc
+++ b/gcc/rust/backend/rust-compile-base.cc
@@ -25,7 +25,8 @@
#include "rust-compile-type.h"
#include "rust-constexpr.h"
#include "rust-diagnostics.h"
-#include "rust-expr.h" // for AST::AttrInputLiteral
+#include "rust-expr.h" // for AST::AttrInputLiteral
+#include "rust-hir-map.h"
#include "rust-macro.h" // for AST::MetaNameValueStr
#include "rust-hir-path-probe.h"
#include "rust-type-util.h"
@@ -39,6 +40,9 @@
#include "tree.h"
#include "print-tree.h"
+// rust-name-resolution-2.0
+#include "options.h"
+
namespace Rust {
namespace Compile {
@@ -667,6 +671,11 @@ HIRCompileBase::compile_function (
}
std::string asm_name = fn_name;
+ auto &mappings = Analysis::Mappings::get ();
+
+ if (flag_name_resolution_2_0)
+ ir_symbol_name = mappings.get_current_crate_name () + "::" + ir_symbol_name;
+
unsigned int flags = 0;
tree fndecl = Backend::function (compiled_fn_type, ir_symbol_name,
"" /* asm_name */, flags, locus);