Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions gcc/rust/backend/rust-compile-intrinsic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,12 @@ Intrinsics::compile (TyTy::FnType *fntype)
static bool
check_for_cached_intrinsic (Context *ctx, TyTy::FnType *fntype, tree *lookup)
{
const Resolver::CanonicalPath &canonical_path = fntype->get_ident ().path;
std::string asm_name = ctx->mangle_item (fntype, canonical_path);
if (ctx->lookup_function_decl (fntype->get_ty_ref (), lookup,
fntype->get_id (), fntype))
fntype->get_id (), fntype, asm_name))
{
// Has this been added to the list? Then it must be finished
if (ctx->function_completed (*lookup))
{
tree dummy = NULL_TREE;
if (!ctx->lookup_function_decl (fntype->get_ty_ref (), &dummy))
ctx->insert_function_decl (fntype, *lookup);
return true;
}
return true;
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion gcc/rust/backend/rust-mangle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static std::string
legacy_mangle_item (const TyTy::BaseType *ty,
const Resolver::CanonicalPath &path)
{
const std::string hash = legacy_hash (ty->as_string ());
const std::string hash = legacy_hash (ty->mangle_string ());
const std::string hash_sig = legacy_mangle_name (hash);

return kMangledSymbolPrefix + legacy_mangle_canonical_path (path) + hash_sig
Expand Down
6 changes: 6 additions & 0 deletions gcc/rust/typecheck/rust-tyty.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ class BaseType : public TypeBoundsMappings
bool has_subsititions_defined () const;
bool needs_generic_substitutions () const;

std::string mangle_string () const
{
return TypeKindFormat::to_string (get_kind ()) + ":" + as_string () + ":"
+ mappings_str () + ":" + bounds_as_string ();
}

/* Returns a pointer to a clone of this. The caller is responsible for
* releasing the memory of the returned ty. */
virtual BaseType *clone () const = 0;
Expand Down