aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-05-03 13:03:32 -0700
committerPatrick Walton <[email protected]>2011-05-03 14:41:05 -0700
commit3f317ede41d69a8fd5e1690c4ed509a4e826ea11 (patch)
treef05696b1e3133dfdb4e95adbb371dee3e385949d /src
parentRemove calls to rustboot -rdeps, leave 'touch' in place while working on repl... (diff)
downloadrust-3f317ede41d69a8fd5e1690c4ed509a4e826ea11.tar.xz
rust-3f317ede41d69a8fd5e1690c4ed509a4e826ea11.zip
rustc: Name type glue properly
Diffstat (limited to 'src')
-rw-r--r--src/comp/middle/trans.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index e8138392..4c9e2990 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -184,7 +184,7 @@ fn path_name(vec[str] path) -> str {
}
-fn mangle_name_by_type(@crate_ctxt ccx, vec[str] path, ty.t t) -> str {
+fn get_type_sha1(@crate_ctxt ccx, ty.t t) -> str {
auto hash = "";
alt (ccx.type_sha1s.find(t)) {
case (some[str](?h)) { hash = h; }
@@ -200,9 +200,24 @@ fn mangle_name_by_type(@crate_ctxt ccx, vec[str] path, ty.t t) -> str {
ccx.type_sha1s.insert(t, hash);
}
}
+ ret hash;
+}
+
+fn mangle_name_by_type(@crate_ctxt ccx, vec[str] path, ty.t t) -> str {
+ auto hash = get_type_sha1(ccx, t);
ret sep() + "rust" + sep() + hash + sep() + path_name(path);
}
+fn mangle_name_by_type_only(@crate_ctxt ccx, ty.t t, str name) -> str {
+ auto f = metadata.def_to_str;
+ auto cx = @rec(ds=f, tcx=ccx.tcx,
+ use_abbrevs=false, abbrevs=ccx.type_abbrevs);
+ auto s = metadata.Encode.ty_str(cx, t);
+
+ auto hash = get_type_sha1(ccx, t);
+ ret sep() + "rust" + sep() + hash + sep() + name + "_" + s;
+}
+
fn mangle_name_by_seq(@crate_ctxt ccx, vec[str] path, str flav) -> str {
ret sep() + "rust" + sep()
+ ccx.names.next(flav) + sep()
@@ -1774,8 +1789,7 @@ fn declare_generic_glue(@local_ctxt cx,
ty.t t,
TypeRef llfnty,
str name) -> ValueRef {
- auto gcx = @rec(path=vec("glue", name) with *cx);
- auto fn_nm = mangle_name_by_seq(cx.ccx, cx.path, "glue");
+ auto fn_nm = mangle_name_by_type_only(cx.ccx, t, "glue_" + name);
fn_nm = sanitize(fn_nm);
auto llfn = decl_internal_fastcall_fn(cx.ccx.llmod, fn_nm, llfnty);
ret llfn;