@@ -16,10 +16,10 @@ use lib::llvm::llvm;
16
16
use lib:: llvm:: { ModuleRef , mk_pass_manager, mk_target_data, True , False } ;
17
17
use lib:: llvm:: { PassManagerRef , FileType } ;
18
18
use lib;
19
- use metadata:: common:: link_meta ;
19
+ use metadata:: common:: LinkMeta ;
20
20
use metadata:: filesearch;
21
21
use metadata:: { encoder, cstore} ;
22
- use middle:: trans:: common:: crate_ctxt ;
22
+ use middle:: trans:: common:: CrateContext ;
23
23
use middle:: ty;
24
24
use session:: Session ;
25
25
use session;
@@ -451,15 +451,16 @@ pub mod write {
451
451
*/
452
452
453
453
pub fn build_link_meta ( sess : Session , c : & ast:: crate , output : & Path ,
454
- symbol_hasher : & hash:: State ) -> link_meta {
454
+ symbol_hasher : & hash:: State ) -> LinkMeta {
455
455
456
- type provided_metas =
457
- { name : Option < @str > ,
458
- vers : Option < @str > ,
459
- cmh_items : ~[ @ast:: meta_item ] } ;
456
+ struct ProvidedMetas {
457
+ name : Option < @str > ,
458
+ vers : Option < @str > ,
459
+ cmh_items : ~[ @ast:: meta_item ]
460
+ }
460
461
461
462
fn provided_link_metas ( sess : Session , c : & ast:: crate ) ->
462
- provided_metas {
463
+ ProvidedMetas {
463
464
let mut name = None ;
464
465
let mut vers = None ;
465
466
let mut cmh_items = ~[ ] ;
@@ -480,7 +481,12 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
480
481
}
481
482
} else { cmh_items. push ( * meta) ; }
482
483
}
483
- return { name: name, vers: vers, cmh_items: cmh_items} ;
484
+
485
+ ProvidedMetas {
486
+ name : name,
487
+ vers : vers,
488
+ cmh_items : cmh_items
489
+ }
484
490
}
485
491
486
492
// This calculates CMH as defined above
@@ -563,16 +569,23 @@ pub fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
563
569
} ;
564
570
}
565
571
566
- let { name: opt_name , vers: opt_vers ,
567
- cmh_items : cmh_items } = provided_link_metas ( sess, c) ;
572
+ let ProvidedMetas {
573
+ name : opt_name,
574
+ vers : opt_vers,
575
+ cmh_items : cmh_items
576
+ } = provided_link_metas ( sess, c) ;
568
577
let name = crate_meta_name ( sess, output, opt_name) ;
569
578
let vers = crate_meta_vers ( sess, opt_vers) ;
570
579
let dep_hashes = cstore:: get_dep_hashes ( sess. cstore ) ;
571
580
let extras_hash =
572
581
crate_meta_extras_hash ( symbol_hasher, cmh_items,
573
582
dep_hashes) ;
574
583
575
- return { name: name, vers: vers, extras_hash: extras_hash} ;
584
+ LinkMeta {
585
+ name : name,
586
+ vers : vers,
587
+ extras_hash : extras_hash
588
+ }
576
589
}
577
590
578
591
pub fn truncated_hash_result ( symbol_hasher : & hash:: State ) -> ~str {
@@ -584,7 +597,7 @@ pub fn truncated_hash_result(symbol_hasher: &hash::State) -> ~str {
584
597
585
598
// This calculates STH for a symbol, as defined above
586
599
pub fn symbol_hash( tcx : ty:: ctxt , symbol_hasher : & hash:: State , t : ty:: t ,
587
- link_meta : link_meta ) -> @str {
600
+ link_meta : LinkMeta ) -> @str {
588
601
// NB: do *not* use abbrevs here as we want the symbol names
589
602
// to be independent of one another in the crate.
590
603
@@ -601,7 +614,7 @@ pub fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
601
614
hash.to_managed()
602
615
}
603
616
604
- pub fn get_symbol_hash(ccx: @crate_ctxt , t: ty::t) -> @str {
617
+ pub fn get_symbol_hash(ccx: @CrateContext , t: ty::t) -> @str {
605
618
match ccx.type_hashcodes.find(&t) {
606
619
Some(h) => h,
607
620
None => {
@@ -673,14 +686,16 @@ pub fn exported_name(sess: Session,
673
686
path_name ( sess. ident_of ( vers. to_owned ( ) ) ) ) ) ;
674
687
}
675
688
676
- pub fn mangle_exported_name ( ccx : @crate_ctxt , +path : path, t : ty:: t ) -> ~str {
689
+ pub fn mangle_exported_name ( ccx : @CrateContext ,
690
+ +path : path,
691
+ t : ty:: t ) -> ~str {
677
692
let hash = get_symbol_hash ( ccx, t) ;
678
693
return exported_name ( ccx. sess , path,
679
694
hash,
680
695
ccx. link_meta . vers ) ;
681
696
}
682
697
683
- pub fn mangle_internal_name_by_type_only ( ccx : @crate_ctxt ,
698
+ pub fn mangle_internal_name_by_type_only ( ccx : @CrateContext ,
684
699
t : ty:: t ,
685
700
name : & str ) -> ~str {
686
701
let s = ppaux:: ty_to_short_str ( ccx. tcx , t) ;
@@ -691,23 +706,23 @@ pub fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
691
706
path_name ( ccx. sess . ident_of ( hash. to_owned ( ) ) ) ] ) ;
692
707
}
693
708
694
- pub fn mangle_internal_name_by_path_and_seq ( ccx : @crate_ctxt ,
709
+ pub fn mangle_internal_name_by_path_and_seq ( ccx : @CrateContext ,
695
710
+path : path,
696
711
+flav : ~str ) -> ~str {
697
712
return mangle ( ccx. sess ,
698
713
vec:: append_one ( path, path_name ( ( ccx. names ) ( flav) ) ) ) ;
699
714
}
700
715
701
- pub fn mangle_internal_name_by_path ( ccx : @crate_ctxt , +path : path) -> ~str {
716
+ pub fn mangle_internal_name_by_path ( ccx : @CrateContext , +path : path) -> ~str {
702
717
return mangle ( ccx. sess , path) ;
703
718
}
704
719
705
- pub fn mangle_internal_name_by_seq ( ccx : @crate_ctxt , +flav : ~str ) -> ~str {
720
+ pub fn mangle_internal_name_by_seq ( ccx : @CrateContext , +flav : ~str ) -> ~str {
706
721
return fmt ! ( "%s_%u" , flav, ( ccx. names) ( flav) . repr) ;
707
722
}
708
723
709
724
710
- pub fn output_dll_filename ( os : session:: os , lm : link_meta ) -> ~str {
725
+ pub fn output_dll_filename ( os : session:: os , lm : LinkMeta ) -> ~str {
711
726
let libname = fmt ! ( "%s-%s-%s" , lm. name, lm. extras_hash, lm. vers) ;
712
727
let ( dll_prefix, dll_suffix) = match os {
713
728
session:: os_win32 => ( win32:: DLL_PREFIX , win32:: DLL_SUFFIX ) ,
@@ -725,7 +740,7 @@ pub fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
725
740
pub fn link_binary( sess : Session ,
726
741
obj_filename : & Path ,
727
742
out_filename : & Path ,
728
- lm : link_meta ) {
743
+ lm : LinkMeta ) {
729
744
// Converts a library file-stem into a cc -l argument
730
745
fn unlib ( config : @session:: config , +stem : ~str ) -> ~str {
731
746
if stem. starts_with ( "lib" ) &&
0 commit comments