aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-context.h
diff options
context:
space:
mode:
authorCohenArthur <arthur.cohen@epita.fr>2021-08-11 23:30:11 +0200
committerCohenArthur <arthur.cohen@epita.fr>2021-09-05 17:21:40 +0200
commit91507076503d57982218c726a712c48adc7a4e1d (patch)
tree2a84bd1e2ea1df140aa3ac31b1c3fd5dbf0cea33 /gcc/rust/backend/rust-compile-context.h
parent50623899998de5a8ffe47227a351c2b3dd29aa0a (diff)
downloadgcc-91507076503d57982218c726a712c48adc7a4e1d.zip
gcc-91507076503d57982218c726a712c48adc7a4e1d.tar.gz
gcc-91507076503d57982218c726a712c48adc7a4e1d.tar.bz2
name_mangling: Add Mangler class with multiple versions
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r--gcc/rust/backend/rust-compile-context.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index bffe97c..126d058 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -28,6 +28,7 @@
#include "rust-ast-full.h"
#include "rust-hir-full.h"
#include "rust-hir-const-fold-ctx.h"
+#include "rust-mangle.h"
namespace Rust {
namespace Compile {
@@ -45,7 +46,7 @@ public:
: backend (backend), resolver (Resolver::Resolver::get ()),
tyctx (Resolver::TypeCheckContext::get ()),
mappings (Analysis::Mappings::get ()),
- const_ctx (ConstFold::Context::get ())
+ const_ctx (ConstFold::Context::get ()), mangler (Mangler (Mangler::MangleVersion::LEGACY))
{
// insert the builtins
auto builtins = resolver->get_builtin_types ();
@@ -285,13 +286,19 @@ public:
return pop;
}
- // this needs to support Legacy and V0 see github #429 or #305
std::string mangle_item (const TyTy::BaseType *ty,
- const Resolver::CanonicalPath &path) const;
+ const Resolver::CanonicalPath &path) const
+ {
+ return mangler.mangle_item (ty, path, mappings->get_current_crate_name ());
+ }
std::string mangle_impl_item (const TyTy::BaseType *self,
const TyTy::BaseType *ty,
- const std::string &name) const;
+ const std::string &name) const
+ {
+ return mangler.mangle_impl_item (self, ty, name,
+ mappings->get_current_crate_name ());
+ }
private:
::Backend *backend;
@@ -300,6 +307,7 @@ private:
Analysis::Mappings *mappings;
ConstFold::Context *const_ctx;
std::set<HirId> builtin_range;
+ Mangler mangler;
// state
std::vector<fncontext> fn_stack;