Rename is_translated_fn query to is_translated_item and make it support statics.
This commit is contained in:
parent
8ff633cc3b
commit
1be7f966e0
5 changed files with 7 additions and 6 deletions
|
|
@ -625,7 +625,7 @@ define_dep_nodes!( <'tcx>
|
|||
[eval_always] CollectAndPartitionTranslationItems,
|
||||
[] ExportName(DefId),
|
||||
[] ContainsExternIndicator(DefId),
|
||||
[] IsTranslatedFunction(DefId),
|
||||
[] IsTranslatedItem(DefId),
|
||||
[] CodegenUnit(InternedString),
|
||||
[] CompileCodegenUnit(InternedString),
|
||||
[input] OutputFilenames,
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ define_maps! { <'tcx>
|
|||
[] fn export_name: ExportName(DefId) -> Option<Symbol>,
|
||||
[] fn contains_extern_indicator: ContainsExternIndicator(DefId) -> bool,
|
||||
[] fn symbol_export_level: GetSymbolExportLevel(DefId) -> SymbolExportLevel,
|
||||
[] fn is_translated_function: IsTranslatedFunction(DefId) -> bool,
|
||||
[] fn is_translated_item: IsTranslatedItem(DefId) -> bool,
|
||||
[] fn codegen_unit: CodegenUnit(InternedString) -> Arc<CodegenUnit<'tcx>>,
|
||||
[] fn compile_codegen_unit: CompileCodegenUnit(InternedString) -> Stats,
|
||||
[] fn output_filenames: output_filenames_node(CrateNum)
|
||||
|
|
|
|||
|
|
@ -929,7 +929,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
|
|||
DepKind::ContainsExternIndicator => {
|
||||
force!(contains_extern_indicator, def_id!());
|
||||
}
|
||||
DepKind::IsTranslatedFunction => { force!(is_translated_function, def_id!()); }
|
||||
DepKind::IsTranslatedItem => { force!(is_translated_item, def_id!()); }
|
||||
DepKind::OutputFilenames => { force!(output_filenames, LOCAL_CRATE); }
|
||||
|
||||
DepKind::TargetFeaturesWhitelist => { force!(target_features_whitelist, LOCAL_CRATE); }
|
||||
|
|
|
|||
|
|
@ -1004,6 +1004,7 @@ fn collect_and_partition_translation_items<'a, 'tcx>(
|
|||
let translation_items: DefIdSet = items.iter().filter_map(|trans_item| {
|
||||
match *trans_item {
|
||||
MonoItem::Fn(ref instance) => Some(instance.def_id()),
|
||||
MonoItem::Static(def_id) => Some(def_id),
|
||||
_ => None,
|
||||
}
|
||||
}).collect();
|
||||
|
|
@ -1107,7 +1108,7 @@ impl CrateInfo {
|
|||
}
|
||||
}
|
||||
|
||||
fn is_translated_function(tcx: TyCtxt, id: DefId) -> bool {
|
||||
fn is_translated_item(tcx: TyCtxt, id: DefId) -> bool {
|
||||
let (all_trans_items, _) =
|
||||
tcx.collect_and_partition_translation_items(LOCAL_CRATE);
|
||||
all_trans_items.contains(&id)
|
||||
|
|
@ -1222,7 +1223,7 @@ pub fn provide(providers: &mut Providers) {
|
|||
providers.collect_and_partition_translation_items =
|
||||
collect_and_partition_translation_items;
|
||||
|
||||
providers.is_translated_function = is_translated_function;
|
||||
providers.is_translated_item = is_translated_item;
|
||||
|
||||
providers.codegen_unit = |tcx, name| {
|
||||
let (_, all) = tcx.collect_and_partition_translation_items(LOCAL_CRATE);
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ pub fn get_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
|
|||
unsafe {
|
||||
llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::ExternalLinkage);
|
||||
|
||||
if cx.tcx.is_translated_function(instance_def_id) {
|
||||
if cx.tcx.is_translated_item(instance_def_id) {
|
||||
if instance_def_id.is_local() {
|
||||
if !cx.tcx.is_exported_symbol(instance_def_id) {
|
||||
llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue