rustc: Migrate CStore::expored_symbols to a query

This commit is contained in:
Alex Crichton 2017-08-28 17:06:03 -07:00
parent ed6f868bf7
commit 98b74c580f
5 changed files with 9 additions and 9 deletions

View File

@ -535,6 +535,7 @@ define_dep_nodes!( <'tcx>
[] GetPanicStrategy(CrateNum),
[] IsNoBuiltins(CrateNum),
[] ImplDefaultness(DefId),
[] ExportedSymbols(CrateNum),
);
trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug {

View File

@ -258,7 +258,6 @@ pub trait CrateStore {
fn plugin_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
fn derive_registrar_fn(&self, cnum: CrateNum) -> Option<DefId>;
fn native_libraries(&self, cnum: CrateNum) -> Vec<NativeLibrary>;
fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId>;
// resolve
fn def_key(&self, def: DefId) -> DefKey;
@ -367,7 +366,6 @@ impl CrateStore for DummyCrateStore {
{ bug!("derive_registrar_fn") }
fn native_libraries(&self, cnum: CrateNum) -> Vec<NativeLibrary>
{ bug!("native_libraries") }
fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId> { bug!("exported_symbols") }
// resolve
fn def_key(&self, def: DefId) -> DefKey { bug!("def_key") }

View File

@ -587,6 +587,12 @@ impl<'tcx> QueryDescription for queries::is_sanitizer_runtime<'tcx> {
}
}
impl<'tcx> QueryDescription for queries::exported_symbols<'tcx> {
fn describe(_tcx: TyCtxt, _: CrateNum) -> String {
format!("looking up the exported symbols of a crate")
}
}
// If enabled, send a message to the profile-queries thread
macro_rules! profq_msg {
($tcx:expr, $msg:expr) => {
@ -1163,6 +1169,7 @@ define_maps! { <'tcx>
[] fn lint_levels: lint_levels_node(CrateNum) -> Rc<lint::LintLevelMap>,
[] fn impl_defaultness: ImplDefaultness(DefId) -> hir::Defaultness,
[] fn exported_symbols: ExportedSymbols(CrateNum) -> Rc<Vec<DefId>>,
}
fn type_param_predicates<'tcx>((item_id, param_id): (DefId, DefId)) -> DepConstructor<'tcx> {

View File

@ -163,6 +163,7 @@ provide! { <'tcx> tcx, def_id, cdata,
extern_crate => { Rc::new(cdata.extern_crate.get()) }
is_no_builtins => { cdata.is_no_builtins(&tcx.dep_graph) }
impl_defaultness => { cdata.get_impl_defaultness(def_id.index) }
exported_symbols => { Rc::new(cdata.get_exported_symbols(&tcx.dep_graph)) }
}
pub fn provide_local<'tcx>(providers: &mut Providers<'tcx>) {
@ -302,11 +303,6 @@ impl CrateStore for cstore::CStore {
self.get_crate_data(cnum).get_native_libraries(&self.dep_graph)
}
fn exported_symbols(&self, cnum: CrateNum) -> Vec<DefId>
{
self.get_crate_data(cnum).get_exported_symbols(&self.dep_graph)
}
/// Returns the `DefKey` for a given `DefId`. This indicates the
/// parent `DefId` as well as some idea of what kind of data the
/// `DefId` refers to.

View File

@ -131,8 +131,6 @@ impl ExportedSymbols {
tcx.is_panic_runtime(cnum) || tcx.is_compiler_builtins(cnum);
let crate_exports = tcx
.sess
.cstore
.exported_symbols(cnum)
.iter()
.map(|&def_id| {