Skip to content

Commit 19d4ea1

Browse files
pcwaltonhuonw
authored andcommitted
librustc: De-@str the LLVM symbol list
1 parent 0f3a4e1 commit 19d4ea1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ pub fn set_no_split_stack(f: ValueRef) {
510510

511511
// Double-check that we never ask LLVM to declare the same symbol twice. It
512512
// silently mangles such symbols, breaking our linkage model.
513-
pub fn note_unique_llvm_symbol(ccx: &CrateContext, sym: @str) {
513+
pub fn note_unique_llvm_symbol(ccx: &CrateContext, sym: ~str) {
514514
let mut all_llvm_symbols = ccx.all_llvm_symbols.borrow_mut();
515515
if all_llvm_symbols.get().contains(&sym) {
516516
ccx.sess.bug(~"duplicate LLVM symbol: " + sym);

src/librustc/middle/trans/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub struct CrateContext {
9797
adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
9898
symbol_hasher: RefCell<Sha256>,
9999
type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
100-
all_llvm_symbols: RefCell<HashSet<@str>>,
100+
all_llvm_symbols: RefCell<HashSet<~str>>,
101101
tcx: ty::ctxt,
102102
maps: astencode::Maps,
103103
stats: @Stats,

src/librustc/middle/trans/glue.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,14 +471,14 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
471471

472472
let llsize = llsize_of(ccx, llty);
473473
let llalign = llalign_of(ccx, llty);
474-
let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc").to_managed();
475-
note_unique_llvm_symbol(ccx, name);
474+
let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc");
476475
debug!("+++ declare_tydesc {} {}", ppaux::ty_to_str(ccx.tcx, t), name);
477476
let gvar = name.with_c_str(|buf| {
478477
unsafe {
479478
llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type.to_ref(), buf)
480479
}
481480
});
481+
note_unique_llvm_symbol(ccx, name);
482482

483483
let ty_name = token::intern_and_get_ident(ppaux::ty_to_str(ccx.tcx, t));
484484
let ty_name = C_str_slice(ccx, ty_name);
@@ -499,10 +499,10 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
499499
fn declare_generic_glue(ccx: &CrateContext, t: ty::t, llfnty: Type,
500500
name: &str) -> ValueRef {
501501
let _icx = push_ctxt("declare_generic_glue");
502-
let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, (~"glue_" + name)).to_managed();
502+
let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, ~"glue_" + name);
503503
debug!("{} is for type {}", fn_nm, ppaux::ty_to_str(ccx.tcx, t));
504-
note_unique_llvm_symbol(ccx, fn_nm);
505504
let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty, ty::mk_nil());
505+
note_unique_llvm_symbol(ccx, fn_nm);
506506
return llfn;
507507
}
508508

0 commit comments

Comments
 (0)