Skip to content

Commit 648f3a6

Browse files
committed
---
yaml --- r: 42342 b: refs/heads/master c: f13ea41 h: refs/heads/master v: v3
1 parent becec2a commit 648f3a6

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: cf6c3d96fb1a7230cbdd8ebc77af30ba35b9e35a
2+
refs/heads/master: f13ea4121eb8997ecdbdd616443267e56efe678b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/librustc/middle/trans/base.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub fn log_fn_time(ccx: @crate_ctxt, +name: ~str, start: time::Timespec,
137137
ccx.stats.fn_times.push({ident: name, time: elapsed});
138138
}
139139

140-
pub fn decl_fn(llmod: ModuleRef, name: ~str, cc: lib::llvm::CallConv,
140+
pub fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv,
141141
llty: TypeRef) -> ValueRef {
142142
let llfn: ValueRef = str::as_c_str(name, |buf| {
143143
unsafe {
@@ -150,7 +150,7 @@ pub fn decl_fn(llmod: ModuleRef, name: ~str, cc: lib::llvm::CallConv,
150150
return llfn;
151151
}
152152

153-
pub fn decl_cdecl_fn(llmod: ModuleRef, +name: ~str, llty: TypeRef)
153+
pub fn decl_cdecl_fn(llmod: ModuleRef, name: &str, llty: TypeRef)
154154
-> ValueRef {
155155
return decl_fn(llmod, name, lib::llvm::CCallConv, llty);
156156
}
@@ -164,20 +164,19 @@ pub fn decl_internal_cdecl_fn(llmod: ModuleRef, +name: ~str, llty: TypeRef) ->
164164
return llfn;
165165
}
166166

167-
pub fn get_extern_fn(externs: HashMap<~str, ValueRef>,
167+
pub fn get_extern_fn(externs: ExternMap,
168168
llmod: ModuleRef,
169-
+name: ~str,
169+
name: @str,
170170
cc: lib::llvm::CallConv,
171171
ty: TypeRef) -> ValueRef {
172172
if externs.contains_key_ref(&name) { return externs.get(&name); }
173-
// XXX: Bad copy.
174-
let f = decl_fn(llmod, copy name, cc, ty);
173+
let f = decl_fn(llmod, name, cc, ty);
175174
externs.insert(name, f);
176175
return f;
177176
}
178177

179-
pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
180-
+name: ~str, ty: TypeRef) -> ValueRef {
178+
pub fn get_extern_const(externs: ExternMap, llmod: ModuleRef,
179+
name: @str, ty: TypeRef) -> ValueRef {
181180
unsafe {
182181
if externs.contains_key_ref(&name) { return externs.get(&name); }
183182
let c = str::as_c_str(name, |buf| {
@@ -189,9 +188,9 @@ pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
189188
}
190189

191190
fn get_simple_extern_fn(cx: block,
192-
externs: HashMap<~str, ValueRef>,
191+
externs: ExternMap,
193192
llmod: ModuleRef,
194-
+name: ~str,
193+
name: @str,
195194
n_args: int) -> ValueRef {
196195
let _icx = cx.insn_ctxt("get_simple_extern_fn");
197196
let ccx = cx.fcx.ccx;
@@ -201,8 +200,8 @@ pub fn get_extern_const(externs: HashMap<~str, ValueRef>, llmod: ModuleRef,
201200
return get_extern_fn(externs, llmod, name, lib::llvm::CCallConv, t);
202201
}
203202

204-
pub fn trans_foreign_call(cx: block, externs: HashMap<~str, ValueRef>,
205-
llmod: ModuleRef, +name: ~str, args: ~[ValueRef]) ->
203+
pub fn trans_foreign_call(cx: block, externs: ExternMap,
204+
llmod: ModuleRef, name: @str, args: ~[ValueRef]) ->
206205
ValueRef {
207206
let _icx = cx.insn_ctxt("trans_foreign_call");
208207
let n = args.len() as int;
@@ -474,6 +473,7 @@ pub fn get_res_dtor(ccx: @crate_ctxt, did: ast::def_id,
474473
let class_ty = ty::subst_tps(tcx, substs, None,
475474
ty::lookup_item_type(tcx, parent_id).ty);
476475
let llty = type_of_dtor(ccx, class_ty);
476+
let name = name.to_managed(); // :-(
477477
get_extern_fn(ccx.externs, ccx.llmod, name, lib::llvm::CCallConv,
478478
llty)
479479
}
@@ -775,7 +775,7 @@ pub fn null_env_ptr(bcx: block) -> ValueRef {
775775
776776
pub fn trans_external_path(ccx: @crate_ctxt, did: ast::def_id, t: ty::t)
777777
-> ValueRef {
778-
let name = csearch::get_symbol(ccx.sess.cstore, did);
778+
let name = csearch::get_symbol(ccx.sess.cstore, did).to_managed(); // Sad
779779
match ty::get(t).sty {
780780
ty::ty_fn(_) => {
781781
let llty = type_of_fn_from_ty(ccx, t);

trunk/src/librustc/middle/trans/common.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,15 @@ pub fn BuilderRef_res(B: BuilderRef) -> BuilderRef_res {
152152
}
153153
}
154154

155+
type ExternMap = HashMap<@str, ValueRef>;
156+
155157
// Crate context. Every crate we compile has one of these.
156158
pub struct crate_ctxt {
157159
sess: session::Session,
158160
llmod: ModuleRef,
159161
td: target_data,
160162
tn: type_names,
161-
externs: HashMap<~str, ValueRef>,
163+
externs: ExternMap,
162164
intrinsics: HashMap<~str, ValueRef>,
163165
item_vals: HashMap<ast::node_id, ValueRef>,
164166
exp_map2: resolve::ExportMap2,

0 commit comments

Comments
 (0)