@@ -181,7 +181,7 @@ impl<'self> Drop for StatRecorder<'self> {
181
181
}
182
182
183
183
pub fn decl_fn ( llmod : ModuleRef , name : & str , cc : lib:: llvm:: CallConv , ty : Type ) -> ValueRef {
184
- let llfn: ValueRef = do name. to_c_str ( ) . with_ref |buf| {
184
+ let llfn: ValueRef = do name. with_c_str |buf| {
185
185
unsafe {
186
186
llvm:: LLVMGetOrInsertFunction ( llmod, buf, ty. to_ref ( ) )
187
187
}
@@ -221,7 +221,7 @@ pub fn get_extern_const(externs: &mut ExternMap, llmod: ModuleRef,
221
221
None => ( )
222
222
}
223
223
unsafe {
224
- let c = do name. to_c_str ( ) . with_ref |buf| {
224
+ let c = do name. with_c_str |buf| {
225
225
llvm:: LLVMAddGlobal ( llmod, ty. to_ref ( ) , buf)
226
226
} ;
227
227
externs. insert ( name, c) ;
@@ -523,7 +523,7 @@ pub fn get_res_dtor(ccx: @mut CrateContext,
523
523
// Structural comparison: a rather involved form of glue.
524
524
pub fn maybe_name_value ( cx : & CrateContext , v : ValueRef , s : & str ) {
525
525
if cx. sess . opts . save_temps {
526
- do s. to_c_str ( ) . with_ref |buf| {
526
+ do s. with_c_str |buf| {
527
527
unsafe {
528
528
llvm:: LLVMSetValueName ( v, buf)
529
529
}
@@ -1136,7 +1136,7 @@ pub fn new_block(cx: @mut FunctionContext,
1136
1136
opt_node_info : Option < NodeInfo > )
1137
1137
-> @mut Block {
1138
1138
unsafe {
1139
- let llbb = do name. to_c_str ( ) . with_ref |buf| {
1139
+ let llbb = do name. with_c_str |buf| {
1140
1140
llvm:: LLVMAppendBasicBlockInContext ( cx. ccx . llcx , cx. llfn , buf)
1141
1141
} ;
1142
1142
let bcx = @mut Block :: new ( llbb,
@@ -1553,7 +1553,7 @@ pub struct BasicBlocks {
1553
1553
pub fn mk_staticallocas_basic_block ( llfn : ValueRef ) -> BasicBlockRef {
1554
1554
unsafe {
1555
1555
let cx = task_llcx ( ) ;
1556
- do "static_allocas" . to_c_str ( ) . with_ref | buf| {
1556
+ do "static_allocas" . with_c_str | buf| {
1557
1557
llvm:: LLVMAppendBasicBlockInContext ( cx, llfn, buf)
1558
1558
}
1559
1559
}
@@ -1562,7 +1562,7 @@ pub fn mk_staticallocas_basic_block(llfn: ValueRef) -> BasicBlockRef {
1562
1562
pub fn mk_return_basic_block ( llfn : ValueRef ) -> BasicBlockRef {
1563
1563
unsafe {
1564
1564
let cx = task_llcx ( ) ;
1565
- do "return ".to_c_str().with_ref |buf| {
1565
+ do "return ".with_c_str |buf| {
1566
1566
llvm::LLVMAppendBasicBlockInContext(cx, llfn, buf)
1567
1567
}
1568
1568
}
@@ -2328,7 +2328,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
2328
2328
} ;
2329
2329
decl_cdecl_fn ( ccx. llmod , main_name, llfty)
2330
2330
} ;
2331
- let llbb = do "top" . to_c_str ( ) . with_ref |buf| {
2331
+ let llbb = do "top" . with_c_str |buf| {
2332
2332
unsafe {
2333
2333
llvm:: LLVMAppendBasicBlockInContext ( ccx. llcx , llfn, buf)
2334
2334
}
@@ -2338,7 +2338,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
2338
2338
llvm:: LLVMPositionBuilderAtEnd ( bld, llbb) ;
2339
2339
2340
2340
let crate_map = ccx. crate_map ;
2341
- let opaque_crate_map = do "crate_map" . to_c_str ( ) . with_ref |buf| {
2341
+ let opaque_crate_map = do "crate_map" . with_c_str |buf| {
2342
2342
llvm:: LLVMBuildPointerCast ( bld, crate_map, Type :: i8p ( ) . to_ref ( ) , buf)
2343
2343
} ;
2344
2344
@@ -2356,7 +2356,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
2356
2356
} ;
2357
2357
2358
2358
let args = {
2359
- let opaque_rust_main = do "rust_main" . to_c_str ( ) . with_ref |buf| {
2359
+ let opaque_rust_main = do "rust_main" . with_c_str |buf| {
2360
2360
llvm:: LLVMBuildPointerCast ( bld, rust_main, Type :: i8p ( ) . to_ref ( ) , buf)
2361
2361
} ;
2362
2362
@@ -2438,7 +2438,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2438
2438
2439
2439
unsafe {
2440
2440
let llty = llvm:: LLVMTypeOf ( v) ;
2441
- let g = do sym. to_c_str ( ) . with_ref |buf| {
2441
+ let g = do sym. with_c_str |buf| {
2442
2442
llvm:: LLVMAddGlobal ( ccx. llmod , llty, buf)
2443
2443
} ;
2444
2444
@@ -2471,7 +2471,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2471
2471
2472
2472
match ( attr:: first_attr_value_str_by_name ( i. attrs , "link_section" ) ) {
2473
2473
Some ( sect) => unsafe {
2474
- do sect. to_c_str ( ) . with_ref |buf| {
2474
+ do sect. with_c_str |buf| {
2475
2475
llvm:: LLVMSetSection ( v, buf) ;
2476
2476
}
2477
2477
} ,
@@ -2512,7 +2512,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2512
2512
}
2513
2513
ast:: foreign_item_static( * ) => {
2514
2514
let ident = token:: ident_to_str ( & ni. ident ) ;
2515
- let g = do ident. to_c_str ( ) . with_ref |buf| {
2515
+ let g = do ident. with_c_str |buf| {
2516
2516
unsafe {
2517
2517
let ty = type_of ( ccx, ty) ;
2518
2518
llvm:: LLVMAddGlobal ( ccx. llmod , ty. to_ref ( ) , buf)
@@ -2619,7 +2619,7 @@ pub fn trans_constant(ccx: &mut CrateContext, it: @ast::item) {
2619
2619
let s = mangle_exported_name ( ccx, p, ty:: mk_int ( ) ) . to_managed ( ) ;
2620
2620
let disr_val = vi[ i] . disr_val ;
2621
2621
note_unique_llvm_symbol ( ccx, s) ;
2622
- let discrim_gvar = do s. to_c_str ( ) . with_ref |buf| {
2622
+ let discrim_gvar = do s. with_c_str |buf| {
2623
2623
unsafe {
2624
2624
llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
2625
2625
}
@@ -2814,7 +2814,7 @@ pub fn decl_gc_metadata(ccx: &mut CrateContext, llmod_id: &str) {
2814
2814
}
2815
2815
2816
2816
let gc_metadata_name = ~"_gc_module_metadata_" + llmod_id;
2817
- let gc_metadata = do gc_metadata_name. to_c_str ( ) . with_ref |buf| {
2817
+ let gc_metadata = do gc_metadata_name. with_c_str |buf| {
2818
2818
unsafe {
2819
2819
llvm:: LLVMAddGlobal ( ccx. llmod , Type :: i32 ( ) . to_ref ( ) , buf)
2820
2820
}
@@ -2829,7 +2829,7 @@ pub fn decl_gc_metadata(ccx: &mut CrateContext, llmod_id: &str) {
2829
2829
pub fn create_module_map ( ccx : & mut CrateContext ) -> ValueRef {
2830
2830
let elttype = Type :: struct_ ( [ ccx. int_type , ccx. int_type ] , false ) ;
2831
2831
let maptype = Type :: array ( & elttype, ( ccx. module_data . len ( ) + 1 ) as u64 ) ;
2832
- let map = do "_rust_mod_map" . to_c_str ( ) . with_ref |buf| {
2832
+ let map = do "_rust_mod_map" . with_c_str |buf| {
2833
2833
unsafe {
2834
2834
llvm:: LLVMAddGlobal ( ccx. llmod , maptype. to_ref ( ) , buf)
2835
2835
}
@@ -2877,7 +2877,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
2877
2877
let sym_name = ~"_rust_crate_map_" + mapname;
2878
2878
let arrtype = Type :: array ( & int_type, n_subcrates as u64 ) ;
2879
2879
let maptype = Type :: struct_ ( [ Type :: i32 ( ) , Type :: i8p ( ) , int_type, arrtype] , false ) ;
2880
- let map = do sym_name. to_c_str ( ) . with_ref |buf| {
2880
+ let map = do sym_name. with_c_str |buf| {
2881
2881
unsafe {
2882
2882
llvm:: LLVMAddGlobal ( llmod, maptype. to_ref ( ) , buf)
2883
2883
}
@@ -2896,7 +2896,7 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
2896
2896
cdata. name,
2897
2897
cstore:: get_crate_vers( cstore, i) ,
2898
2898
cstore:: get_crate_hash( cstore, i) ) ;
2899
- let cr = do nm. to_c_str ( ) . with_ref |buf| {
2899
+ let cr = do nm. with_c_str |buf| {
2900
2900
unsafe {
2901
2901
llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
2902
2902
}
@@ -2959,21 +2959,21 @@ pub fn write_metadata(cx: &mut CrateContext, crate: &ast::Crate) {
2959
2959
let encode_parms = crate_ctxt_to_encode_parms ( cx, encode_inlined_item) ;
2960
2960
let llmeta = C_bytes ( encoder:: encode_metadata ( encode_parms, crate ) ) ;
2961
2961
let llconst = C_struct ( [ llmeta] ) ;
2962
- let mut llglobal = do "rust_metadata" . to_c_str ( ) . with_ref |buf| {
2962
+ let mut llglobal = do "rust_metadata" . with_c_str |buf| {
2963
2963
unsafe {
2964
2964
llvm:: LLVMAddGlobal ( cx. llmod , val_ty ( llconst) . to_ref ( ) , buf)
2965
2965
}
2966
2966
} ;
2967
2967
unsafe {
2968
2968
llvm:: LLVMSetInitializer ( llglobal, llconst) ;
2969
- do cx. sess . targ_cfg . target_strs . meta_sect_name . to_c_str ( ) . with_ref |buf| {
2969
+ do cx. sess . targ_cfg . target_strs . meta_sect_name . with_c_str |buf| {
2970
2970
llvm:: LLVMSetSection ( llglobal, buf)
2971
2971
} ;
2972
2972
lib:: llvm:: SetLinkage ( llglobal, lib:: llvm:: InternalLinkage ) ;
2973
2973
2974
2974
let t_ptr_i8 = Type :: i8p ( ) ;
2975
2975
llglobal = llvm:: LLVMConstBitCast ( llglobal, t_ptr_i8. to_ref ( ) ) ;
2976
- let llvm_used = do "llvm.used" . to_c_str ( ) . with_ref |buf| {
2976
+ let llvm_used = do "llvm.used" . with_c_str |buf| {
2977
2977
llvm:: LLVMAddGlobal ( cx. llmod , Type :: array ( & t_ptr_i8, 1 ) . to_ref ( ) , buf)
2978
2978
} ;
2979
2979
lib:: llvm:: SetLinkage ( llvm_used, lib:: llvm:: AppendingLinkage ) ;
@@ -2987,7 +2987,7 @@ fn mk_global(ccx: &CrateContext,
2987
2987
internal : bool )
2988
2988
-> ValueRef {
2989
2989
unsafe {
2990
- let llglobal = do name. to_c_str ( ) . with_ref |buf| {
2990
+ let llglobal = do name. with_c_str |buf| {
2991
2991
llvm:: LLVMAddGlobal ( ccx. llmod , val_ty ( llval) . to_ref ( ) , buf)
2992
2992
} ;
2993
2993
llvm:: LLVMSetInitializer ( llglobal, llval) ;
0 commit comments