librustc: De-@str the LLVM symbol list

This commit is contained in:
Patrick Walton 2014-01-31 12:42:39 -08:00 committed by Huon Wilson
parent 0f3a4e13f9
commit 19d4ea1cba
3 changed files with 6 additions and 6 deletions

View file

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

View file

@ -97,7 +97,7 @@ pub struct CrateContext {
adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
symbol_hasher: RefCell<Sha256>,
type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
all_llvm_symbols: RefCell<HashSet<@str>>,
all_llvm_symbols: RefCell<HashSet<~str>>,
tcx: ty::ctxt,
maps: astencode::Maps,
stats: @Stats,

View file

@ -471,14 +471,14 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
let llsize = llsize_of(ccx, llty);
let llalign = llalign_of(ccx, llty);
let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc").to_managed();
note_unique_llvm_symbol(ccx, name);
let name = mangle_internal_name_by_type_and_seq(ccx, t, "tydesc");
debug!("+++ declare_tydesc {} {}", ppaux::ty_to_str(ccx.tcx, t), name);
let gvar = name.with_c_str(|buf| {
unsafe {
llvm::LLVMAddGlobal(ccx.llmod, ccx.tydesc_type.to_ref(), buf)
}
});
note_unique_llvm_symbol(ccx, name);
let ty_name = token::intern_and_get_ident(ppaux::ty_to_str(ccx.tcx, t));
let ty_name = C_str_slice(ccx, ty_name);
@ -499,10 +499,10 @@ pub fn declare_tydesc(ccx: &CrateContext, t: ty::t) -> @tydesc_info {
fn declare_generic_glue(ccx: &CrateContext, t: ty::t, llfnty: Type,
name: &str) -> ValueRef {
let _icx = push_ctxt("declare_generic_glue");
let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, (~"glue_" + name)).to_managed();
let fn_nm = mangle_internal_name_by_type_and_seq(ccx, t, ~"glue_" + name);
debug!("{} is for type {}", fn_nm, ppaux::ty_to_str(ccx.tcx, t));
note_unique_llvm_symbol(ccx, fn_nm);
let llfn = decl_cdecl_fn(ccx.llmod, fn_nm, llfnty, ty::mk_nil());
note_unique_llvm_symbol(ccx, fn_nm);
return llfn;
}