@@ -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
}
@@ -2332,7 +2332,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
2332
2332
} ;
2333
2333
decl_cdecl_fn ( ccx. llmod , main_name, llfty)
2334
2334
} ;
2335
- let llbb = do "top" . to_c_str ( ) . with_ref |buf| {
2335
+ let llbb = do "top" . with_c_str |buf| {
2336
2336
unsafe {
2337
2337
llvm:: LLVMAppendBasicBlockInContext ( ccx. llcx , llfn, buf)
2338
2338
}
@@ -2342,7 +2342,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
2342
2342
llvm:: LLVMPositionBuilderAtEnd ( bld, llbb) ;
2343
2343
2344
2344
let crate_map = ccx. crate_map ;
2345
- let opaque_crate_map = do "crate_map" . to_c_str ( ) . with_ref |buf| {
2345
+ let opaque_crate_map = do "crate_map" . with_c_str |buf| {
2346
2346
llvm:: LLVMBuildPointerCast ( bld, crate_map, Type :: i8p ( ) . to_ref ( ) , buf)
2347
2347
} ;
2348
2348
@@ -2360,7 +2360,7 @@ pub fn create_entry_wrapper(ccx: @mut CrateContext,
2360
2360
} ;
2361
2361
2362
2362
let args = {
2363
- let opaque_rust_main = do "rust_main" . to_c_str ( ) . with_ref |buf| {
2363
+ let opaque_rust_main = do "rust_main" . with_c_str |buf| {
2364
2364
llvm:: LLVMBuildPointerCast ( bld, rust_main, Type :: i8p ( ) . to_ref ( ) , buf)
2365
2365
} ;
2366
2366
@@ -2442,7 +2442,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2442
2442
2443
2443
unsafe {
2444
2444
let llty = llvm:: LLVMTypeOf ( v) ;
2445
- let g = do sym. to_c_str ( ) . with_ref |buf| {
2445
+ let g = do sym. with_c_str |buf| {
2446
2446
llvm:: LLVMAddGlobal ( ccx. llmod , llty, buf)
2447
2447
} ;
2448
2448
@@ -2475,7 +2475,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2475
2475
2476
2476
match ( attr:: first_attr_value_str_by_name ( i. attrs , "link_section" ) ) {
2477
2477
Some ( sect) => unsafe {
2478
- do sect. to_c_str ( ) . with_ref |buf| {
2478
+ do sect. with_c_str |buf| {
2479
2479
llvm:: LLVMSetSection ( v, buf) ;
2480
2480
}
2481
2481
} ,
@@ -2516,7 +2516,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
2516
2516
}
2517
2517
ast:: foreign_item_static( * ) => {
2518
2518
let ident = token:: ident_to_str ( & ni. ident ) ;
2519
- let g = do ident. to_c_str ( ) . with_ref |buf| {
2519
+ let g = do ident. with_c_str |buf| {
2520
2520
unsafe {
2521
2521
let ty = type_of ( ccx, ty) ;
2522
2522
llvm:: LLVMAddGlobal ( ccx. llmod , ty. to_ref ( ) , buf)
@@ -2623,7 +2623,7 @@ pub fn trans_constant(ccx: &mut CrateContext, it: @ast::item) {
2623
2623
let s = mangle_exported_name ( ccx, p, ty:: mk_int ( ) ) . to_managed ( ) ;
2624
2624
let disr_val = vi[ i] . disr_val ;
2625
2625
note_unique_llvm_symbol ( ccx, s) ;
2626
- let discrim_gvar = do s. to_c_str ( ) . with_ref |buf| {
2626
+ let discrim_gvar = do s. with_c_str |buf| {
2627
2627
unsafe {
2628
2628
llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
2629
2629
}
@@ -2818,7 +2818,7 @@ pub fn decl_gc_metadata(ccx: &mut CrateContext, llmod_id: &str) {
2818
2818
}
2819
2819
2820
2820
let gc_metadata_name = ~"_gc_module_metadata_" + llmod_id;
2821
- let gc_metadata = do gc_metadata_name. to_c_str ( ) . with_ref |buf| {
2821
+ let gc_metadata = do gc_metadata_name. with_c_str |buf| {
2822
2822
unsafe {
2823
2823
llvm:: LLVMAddGlobal ( ccx. llmod , Type :: i32 ( ) . to_ref ( ) , buf)
2824
2824
}
@@ -2833,7 +2833,7 @@ pub fn decl_gc_metadata(ccx: &mut CrateContext, llmod_id: &str) {
2833
2833
pub fn create_module_map ( ccx : & mut CrateContext ) -> ValueRef {
2834
2834
let elttype = Type :: struct_ ( [ ccx. int_type , ccx. int_type ] , false ) ;
2835
2835
let maptype = Type :: array ( & elttype, ( ccx. module_data . len ( ) + 1 ) as u64 ) ;
2836
- let map = do "_rust_mod_map" . to_c_str ( ) . with_ref |buf| {
2836
+ let map = do "_rust_mod_map" . with_c_str |buf| {
2837
2837
unsafe {
2838
2838
llvm:: LLVMAddGlobal ( ccx. llmod , maptype. to_ref ( ) , buf)
2839
2839
}
@@ -2881,7 +2881,7 @@ pub fn decl_crate_map(sess: session::Session, mapmeta: LinkMeta,
2881
2881
let sym_name = ~"_rust_crate_map_" + mapname;
2882
2882
let arrtype = Type :: array ( & int_type, n_subcrates as u64 ) ;
2883
2883
let maptype = Type :: struct_ ( [ Type :: i32 ( ) , Type :: i8p ( ) , int_type, arrtype] , false ) ;
2884
- let map = do sym_name. to_c_str ( ) . with_ref |buf| {
2884
+ let map = do sym_name. with_c_str |buf| {
2885
2885
unsafe {
2886
2886
llvm:: LLVMAddGlobal ( llmod, maptype. to_ref ( ) , buf)
2887
2887
}
@@ -2900,7 +2900,7 @@ pub fn fill_crate_map(ccx: @mut CrateContext, map: ValueRef) {
2900
2900
cdata. name,
2901
2901
cstore:: get_crate_vers( cstore, i) ,
2902
2902
cstore:: get_crate_hash( cstore, i) ) ;
2903
- let cr = do nm. to_c_str ( ) . with_ref |buf| {
2903
+ let cr = do nm. with_c_str |buf| {
2904
2904
unsafe {
2905
2905
llvm:: LLVMAddGlobal ( ccx. llmod , ccx. int_type . to_ref ( ) , buf)
2906
2906
}
@@ -2963,21 +2963,21 @@ pub fn write_metadata(cx: &mut CrateContext, crate: &ast::Crate) {
2963
2963
let encode_parms = crate_ctxt_to_encode_parms ( cx, encode_inlined_item) ;
2964
2964
let llmeta = C_bytes ( encoder:: encode_metadata ( encode_parms, crate ) ) ;
2965
2965
let llconst = C_struct ( [ llmeta] ) ;
2966
- let mut llglobal = do "rust_metadata" . to_c_str ( ) . with_ref |buf| {
2966
+ let mut llglobal = do "rust_metadata" . with_c_str |buf| {
2967
2967
unsafe {
2968
2968
llvm:: LLVMAddGlobal ( cx. llmod , val_ty ( llconst) . to_ref ( ) , buf)
2969
2969
}
2970
2970
} ;
2971
2971
unsafe {
2972
2972
llvm:: LLVMSetInitializer ( llglobal, llconst) ;
2973
- do cx. sess . targ_cfg . target_strs . meta_sect_name . to_c_str ( ) . with_ref |buf| {
2973
+ do cx. sess . targ_cfg . target_strs . meta_sect_name . with_c_str |buf| {
2974
2974
llvm:: LLVMSetSection ( llglobal, buf)
2975
2975
} ;
2976
2976
lib:: llvm:: SetLinkage ( llglobal, lib:: llvm:: InternalLinkage ) ;
2977
2977
2978
2978
let t_ptr_i8 = Type :: i8p ( ) ;
2979
2979
llglobal = llvm:: LLVMConstBitCast ( llglobal, t_ptr_i8. to_ref ( ) ) ;
2980
- let llvm_used = do "llvm.used" . to_c_str ( ) . with_ref |buf| {
2980
+ let llvm_used = do "llvm.used" . with_c_str |buf| {
2981
2981
llvm:: LLVMAddGlobal ( cx. llmod , Type :: array ( & t_ptr_i8, 1 ) . to_ref ( ) , buf)
2982
2982
} ;
2983
2983
lib:: llvm:: SetLinkage ( llvm_used, lib:: llvm:: AppendingLinkage ) ;
@@ -2991,7 +2991,7 @@ fn mk_global(ccx: &CrateContext,
2991
2991
internal : bool )
2992
2992
-> ValueRef {
2993
2993
unsafe {
2994
- let llglobal = do name. to_c_str ( ) . with_ref |buf| {
2994
+ let llglobal = do name. with_c_str |buf| {
2995
2995
llvm:: LLVMAddGlobal ( ccx. llmod , val_ty ( llval) . to_ref ( ) , buf)
2996
2996
} ;
2997
2997
llvm:: LLVMSetInitializer ( llglobal, llval) ;
0 commit comments