@@ -43,7 +43,8 @@ use syntax::ast_map::{path, path_mod, path_name};
4343use syntax:: attr;
4444use syntax:: print:: pprust;
4545
46- enum output_type {
46+ #[ deriving_eq]
47+ pub enum output_type {
4748 output_type_none,
4849 output_type_bitcode,
4950 output_type_assembly,
@@ -52,13 +53,6 @@ enum output_type {
5253 output_type_exe,
5354}
5455
55- impl output_type : cmp:: Eq {
56- pure fn eq ( & self , other : & output_type ) -> bool {
57- ( ( * self ) as uint ) == ( ( * other) as uint )
58- }
59- pure fn ne ( & self , other : & output_type ) -> bool { !( * self ) . eq ( other) }
60- }
61-
6256pub fn llvm_err ( sess : Session , +msg : ~str ) -> ! {
6357 unsafe {
6458 let cstr = llvm:: LLVMRustGetLastError ( ) ;
@@ -170,15 +164,15 @@ pub mod jit {
170164 }
171165}
172166
173- mod write {
167+ pub mod write {
174168 use back:: link:: jit;
175- use back:: link:: { ModuleRef , WriteOutputFile , output_type} ;
169+ use back:: link:: { WriteOutputFile , output_type} ;
176170 use back:: link:: { output_type_assembly, output_type_bitcode} ;
177171 use back:: link:: { output_type_exe, output_type_llvm_assembly} ;
178172 use back:: link:: { output_type_object} ;
179173 use driver:: session;
180174 use lib:: llvm:: llvm;
181- use lib:: llvm:: { False , True , mk_pass_manager, mk_target_data} ;
175+ use lib:: llvm:: { False , True , ModuleRef , mk_pass_manager, mk_target_data} ;
182176 use lib;
183177 use session:: Session ;
184178
@@ -456,7 +450,7 @@ mod write {
456450 *
457451 */
458452
459- fn build_link_meta ( sess : Session , c : & ast:: crate , output : & Path ,
453+ pub fn build_link_meta ( sess : Session , c : & ast:: crate , output : & Path ,
460454 symbol_hasher : & hash:: State ) -> link_meta {
461455
462456 type provided_metas =
@@ -575,15 +569,15 @@ fn build_link_meta(sess: Session, c: &ast::crate, output: &Path,
575569 return { name: name, vers: vers, extras_hash: extras_hash} ;
576570}
577571
578- fn truncated_hash_result ( symbol_hasher : & hash:: State ) -> ~str {
572+ pub fn truncated_hash_result ( symbol_hasher : & hash:: State ) -> ~str {
579573 unsafe {
580574 symbol_hasher. result_str ( )
581575 }
582576}
583577
584578
585579// This calculates STH for a symbol, as defined above
586- fn symbol_hash( tcx : ty:: ctxt , symbol_hasher : & hash:: State , t : ty:: t ,
580+ pub fn symbol_hash( tcx : ty:: ctxt , symbol_hasher : & hash:: State , t : ty:: t ,
587581 link_meta : link_meta ) -> @str {
588582 // NB: do *not* use abbrevs here as we want the symbol names
589583 // to be independent of one another in the crate.
@@ -601,7 +595,7 @@ fn symbol_hash(tcx: ty::ctxt, symbol_hasher: &hash::State, t: ty::t,
601595 hash.to_managed()
602596}
603597
604- fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
598+ pub fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
605599 match ccx.type_hashcodes.find(t) {
606600 Some(h) => h,
607601 None => {
@@ -615,7 +609,7 @@ fn get_symbol_hash(ccx: @crate_ctxt, t: ty::t) -> @str {
615609
616610// Name sanitation. LLVM will happily accept identifiers with weird names, but
617611// gas doesn't!
618- fn sanitize(s: ~str) -> ~str {
612+ pub fn sanitize(s: ~str) -> ~str {
619613 let mut result = ~" ";
620614 for str :: chars_each( s) |c| {
621615 match c {
@@ -648,7 +642,7 @@ fn sanitize(s: ~str) -> ~str {
648642 return result;
649643}
650644
651- fn mangle ( sess : Session , ss : path ) -> ~str {
645+ pub fn mangle ( sess : Session , ss : path ) -> ~str {
652646 // Follow C++ namespace-mangling style
653647
654648 let mut n = ~"_ZN"; // Begin name-sequence.
@@ -663,26 +657,26 @@ fn mangle(sess: Session, ss: path) -> ~str {
663657 n
664658}
665659
666- fn exported_name ( sess : Session ,
667- +path : path,
668- hash : & str ,
669- vers : & str ) -> ~str {
660+ pub fn exported_name ( sess : Session ,
661+ +path : path,
662+ hash : & str ,
663+ vers : & str ) -> ~str {
670664 return mangle ( sess,
671665 vec:: append_one (
672666 vec:: append_one ( path, path_name ( sess. ident_of ( hash. to_owned ( ) ) ) ) ,
673667 path_name ( sess. ident_of ( vers. to_owned ( ) ) ) ) ) ;
674668}
675669
676- fn mangle_exported_name ( ccx : @crate_ctxt , +path : path, t : ty:: t ) -> ~str {
670+ pub fn mangle_exported_name ( ccx : @crate_ctxt , +path : path, t : ty:: t ) -> ~str {
677671 let hash = get_symbol_hash ( ccx, t) ;
678672 return exported_name ( ccx. sess , path,
679673 hash,
680674 ccx. link_meta . vers ) ;
681675}
682676
683- fn mangle_internal_name_by_type_only ( ccx : @crate_ctxt ,
684- t : ty:: t ,
685- name : & str ) -> ~str {
677+ pub fn mangle_internal_name_by_type_only ( ccx : @crate_ctxt ,
678+ t : ty:: t ,
679+ name : & str ) -> ~str {
686680 let s = ppaux:: ty_to_short_str ( ccx. tcx , t) ;
687681 let hash = get_symbol_hash ( ccx, t) ;
688682 return mangle ( ccx. sess ,
@@ -691,23 +685,23 @@ fn mangle_internal_name_by_type_only(ccx: @crate_ctxt,
691685 path_name ( ccx. sess . ident_of ( hash. to_owned ( ) ) ) ] ) ;
692686}
693687
694- fn mangle_internal_name_by_path_and_seq ( ccx : @crate_ctxt ,
695- +path : path,
696- +flav : ~str ) -> ~str {
688+ pub fn mangle_internal_name_by_path_and_seq ( ccx : @crate_ctxt ,
689+ +path : path,
690+ +flav : ~str ) -> ~str {
697691 return mangle ( ccx. sess ,
698692 vec:: append_one ( path, path_name ( ( ccx. names ) ( flav) ) ) ) ;
699693}
700694
701- fn mangle_internal_name_by_path ( ccx : @crate_ctxt , +path : path) -> ~str {
695+ pub fn mangle_internal_name_by_path ( ccx : @crate_ctxt , +path : path) -> ~str {
702696 return mangle ( ccx. sess , path) ;
703697}
704698
705- fn mangle_internal_name_by_seq ( ccx : @crate_ctxt , +flav : ~str ) -> ~str {
699+ pub fn mangle_internal_name_by_seq ( ccx : @crate_ctxt , +flav : ~str ) -> ~str {
706700 return fmt ! ( "%s_%u" , flav, ( ccx. names) ( flav) . repr) ;
707701}
708702
709703
710- fn output_dll_filename ( os : session:: os , lm : link_meta ) -> ~str {
704+ pub fn output_dll_filename ( os : session:: os , lm : link_meta ) -> ~str {
711705 let libname = fmt ! ( "%s-%s-%s" , lm. name, lm. extras_hash, lm. vers) ;
712706 let ( dll_prefix, dll_suffix) = match os {
713707 session:: os_win32 => ( win32:: DLL_PREFIX , win32:: DLL_SUFFIX ) ,
@@ -722,10 +716,10 @@ fn output_dll_filename(os: session::os, lm: link_meta) -> ~str {
722716
723717// If the user wants an exe generated we need to invoke
724718// cc to link the object file with some libs
725- fn link_binary( sess : Session ,
726- obj_filename : & Path ,
727- out_filename : & Path ,
728- lm : link_meta ) {
719+ pub fn link_binary( sess : Session ,
720+ obj_filename : & Path ,
721+ out_filename : & Path ,
722+ lm : link_meta ) {
729723 // Converts a library file-stem into a cc -l argument
730724 fn unlib ( config : @session:: config , +stem : ~str ) -> ~str {
731725 if stem. starts_with ( "lib" ) &&
0 commit comments