@@ -1243,7 +1243,7 @@ fn contains_null(s: &str) -> bool {
12431243}
12441244
12451245fn write_metadata ( cx : & SharedCrateContext ,
1246- reachable_ids : & NodeSet ) -> Vec < u8 > {
1246+ exported_symbols : & NodeSet ) -> Vec < u8 > {
12471247 use flate;
12481248
12491249 #[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
@@ -1275,7 +1275,7 @@ fn write_metadata(cx: &SharedCrateContext,
12751275 let metadata = cstore. encode_metadata ( cx. tcx ( ) ,
12761276 cx. export_map ( ) ,
12771277 cx. link_meta ( ) ,
1278- reachable_ids ) ;
1278+ exported_symbols ) ;
12791279 if kind == MetadataKind :: Uncompressed {
12801280 return metadata;
12811281 }
@@ -1313,7 +1313,7 @@ fn write_metadata(cx: &SharedCrateContext,
13131313fn internalize_symbols < ' a , ' tcx > ( sess : & Session ,
13141314 ccxs : & CrateContextList < ' a , ' tcx > ,
13151315 symbol_map : & SymbolMap < ' tcx > ,
1316- reachable : & FxHashSet < & str > ) {
1316+ exported_symbols : & FxHashSet < & str > ) {
13171317 let scx = ccxs. shared ( ) ;
13181318 let tcx = scx. tcx ( ) ;
13191319
@@ -1379,7 +1379,7 @@ fn internalize_symbols<'a, 'tcx>(sess: &Session,
13791379 let name_cow = Cow :: Borrowed ( name_str) ;
13801380
13811381 let is_referenced_somewhere = referenced_somewhere. contains ( & name_cstr) ;
1382- let is_reachable = reachable . contains ( & name_str) ;
1382+ let is_reachable = exported_symbols . contains ( & name_str) ;
13831383 let has_fixed_linkage = linkage_fixed_explicitly. contains ( & name_cow) ;
13841384
13851385 if !is_referenced_somewhere && !is_reachable && !has_fixed_linkage {
@@ -1481,7 +1481,7 @@ fn iter_functions(llmod: llvm::ModuleRef) -> ValueIter {
14811481///
14821482/// This list is later used by linkers to determine the set of symbols needed to
14831483/// be exposed from a dynamic library and it's also encoded into the metadata.
1484- pub fn filter_reachable_ids ( tcx : TyCtxt , reachable : NodeSet ) -> NodeSet {
1484+ pub fn find_exported_symbols ( tcx : TyCtxt , reachable : NodeSet ) -> NodeSet {
14851485 reachable. into_iter ( ) . filter ( |& id| {
14861486 // Next, we want to ignore some FFI functions that are not exposed from
14871487 // this crate. Reachable FFI functions can be lumped into two
@@ -1535,7 +1535,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
15351535 let krate = tcx. map . krate ( ) ;
15361536
15371537 let ty:: CrateAnalysis { export_map, reachable, name, .. } = analysis;
1538- let reachable = filter_reachable_ids ( tcx, reachable) ;
1538+ let exported_symbols = find_exported_symbols ( tcx, reachable) ;
15391539
15401540 let check_overflow = if let Some ( v) = tcx. sess . opts . debugging_opts . force_overflow_checks {
15411541 v
@@ -1548,11 +1548,11 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
15481548 let shared_ccx = SharedCrateContext :: new ( tcx,
15491549 export_map,
15501550 link_meta. clone ( ) ,
1551- reachable ,
1551+ exported_symbols ,
15521552 check_overflow) ;
15531553 // Translate the metadata.
15541554 let metadata = time ( tcx. sess . time_passes ( ) , "write metadata" , || {
1555- write_metadata ( & shared_ccx, shared_ccx. reachable ( ) )
1555+ write_metadata ( & shared_ccx, shared_ccx. exported_symbols ( ) )
15561556 } ) ;
15571557
15581558 let metadata_module = ModuleTranslation {
@@ -1608,7 +1608,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
16081608 metadata_module : metadata_module,
16091609 link : link_meta,
16101610 metadata : metadata,
1611- reachable : vec ! [ ] ,
1611+ exported_symbols : vec ! [ ] ,
16121612 no_builtins : no_builtins,
16131613 linker_info : linker_info,
16141614 windows_subsystem : None ,
@@ -1688,17 +1688,17 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
16881688 }
16891689
16901690 let sess = shared_ccx. sess ( ) ;
1691- let mut reachable_symbols = shared_ccx. reachable ( ) . iter ( ) . map ( |& id| {
1691+ let mut exported_symbols = shared_ccx. exported_symbols ( ) . iter ( ) . map ( |& id| {
16921692 let def_id = shared_ccx. tcx ( ) . map . local_def_id ( id) ;
16931693 symbol_for_def_id ( def_id, & shared_ccx, & symbol_map)
16941694 } ) . collect :: < Vec < _ > > ( ) ;
16951695
16961696 if sess. entry_fn . borrow ( ) . is_some ( ) {
1697- reachable_symbols . push ( "main" . to_string ( ) ) ;
1697+ exported_symbols . push ( "main" . to_string ( ) ) ;
16981698 }
16991699
17001700 if sess. crate_types . borrow ( ) . contains ( & config:: CrateTypeDylib ) {
1701- reachable_symbols . push ( shared_ccx. metadata_symbol_name ( ) ) ;
1701+ exported_symbols . push ( shared_ccx. metadata_symbol_name ( ) ) ;
17021702 }
17031703
17041704 // For the purposes of LTO or when creating a cdylib, we add to the
@@ -1708,10 +1708,10 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
17081708 //
17091709 // Note that this happens even if LTO isn't requested or we're not creating
17101710 // a cdylib. In those cases, though, we're not even reading the
1711- // `reachable_symbols ` list later on so it should be ok.
1711+ // `exported_symbols ` list later on so it should be ok.
17121712 for cnum in sess. cstore . crates ( ) {
1713- let syms = sess. cstore . reachable_ids ( cnum) ;
1714- reachable_symbols . extend ( syms. into_iter ( ) . filter ( |& def_id| {
1713+ let syms = sess. cstore . exported_symbols ( cnum) ;
1714+ exported_symbols . extend ( syms. into_iter ( ) . filter ( |& def_id| {
17151715 let applicable = match sess. cstore . describe_def ( def_id) {
17161716 Some ( Def :: Static ( ..) ) => true ,
17171717 Some ( Def :: Fn ( _) ) => {
@@ -1735,7 +1735,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
17351735 internalize_symbols ( sess,
17361736 & crate_context_list,
17371737 & symbol_map,
1738- & reachable_symbols . iter ( )
1738+ & exported_symbols . iter ( )
17391739 . map ( |s| & s[ ..] )
17401740 . collect ( ) )
17411741 } ) ;
@@ -1749,7 +1749,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
17491749 create_imps ( & crate_context_list) ;
17501750 }
17511751
1752- let linker_info = LinkerInfo :: new ( & shared_ccx, & reachable_symbols ) ;
1752+ let linker_info = LinkerInfo :: new ( & shared_ccx, & exported_symbols ) ;
17531753
17541754 let subsystem = attr:: first_attr_value_str_by_name ( & krate. attrs ,
17551755 "windows_subsystem" ) ;
@@ -1767,7 +1767,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
17671767 metadata_module : metadata_module,
17681768 link : link_meta,
17691769 metadata : metadata,
1770- reachable : reachable_symbols ,
1770+ exported_symbols : exported_symbols ,
17711771 no_builtins : no_builtins,
17721772 linker_info : linker_info,
17731773 windows_subsystem : windows_subsystem,
0 commit comments