aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-mangle.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-01-29 14:55:51 +0000
committerPhilip Herron <philip.herron@embecosm.com>2022-01-29 14:56:27 +0000
commit2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f (patch)
treef5fc89773ab1941593f3f2230908919063679c68 /gcc/rust/backend/rust-mangle.cc
parenta065f205c3171e63b4efee0b9d890782e95a691b (diff)
downloadgcc-2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f.zip
gcc-2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f.tar.gz
gcc-2fbf9cb25e930e2df86d05e0f7f707e69bae2b1f.tar.bz2
Track the cratenum for the respective canonical path
This means we can get the crate name to squash the warning in the V0 symbol mangling scheme.
Diffstat (limited to 'gcc/rust/backend/rust-mangle.cc')
-rw-r--r--gcc/rust/backend/rust-mangle.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/rust/backend/rust-mangle.cc b/gcc/rust/backend/rust-mangle.cc
index 2c86488..eaf7814 100644
--- a/gcc/rust/backend/rust-mangle.cc
+++ b/gcc/rust/backend/rust-mangle.cc
@@ -252,12 +252,16 @@ legacy_mangle_item (const TyTy::BaseType *ty,
static std::string
v0_mangle_item (const TyTy::BaseType *ty, const Resolver::CanonicalPath &path)
{
- std::string mangled;
+ // we can get this from the canonical_path
+ auto mappings = Analysis::Mappings::get ();
+ std::string crate_name;
+ bool ok = mappings->get_crate_name (path.get_crate_num (), crate_name);
+ rust_assert (ok);
+ std::string mangled;
// FIXME: Add real algorithm once all pieces are implemented
auto ty_prefix = v0_type_prefix (ty);
- // crate name must be assumed to be part of the canonical path
- // v0_add_identifier (mangled, crate_name);
+ v0_add_identifier (mangled, crate_name);
v0_add_disambiguator (mangled, 62);
gcc_unreachable ();