use util::nodemap::FxHashMap;
use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
use rustc::session::config;
+use rustc::ty::TyCtxt;
use syntax::attr;
use trans_item::TransItem;
}
if scx.sess().crate_types.borrow().contains(&config::CrateTypeDylib) {
- local_crate.push((scx.metadata_symbol_name(),
+ local_crate.push((metadata_symbol_name(scx.tcx()),
SymbolExportLevel::Rust));
}
}
}
+pub fn metadata_symbol_name(tcx: TyCtxt) -> String {
+ format!("rust_metadata_{}_{}",
+ tcx.crate_name(LOCAL_CRATE),
+ tcx.crate_disambiguator(LOCAL_CRATE))
+}
+
pub fn crate_export_threshold(crate_type: config::CrateType)
-> SymbolExportLevel {
match crate_type {
let llmeta = C_bytes_in_context(metadata_llcx, &compressed);
let llconst = C_struct_in_context(metadata_llcx, &[llmeta], false);
- let name = cx.metadata_symbol_name();
+ let name = symbol_export::metadata_symbol_name(cx.tcx());
let buf = CString::new(name).unwrap();
let llglobal = unsafe {
llvm::LLVMAddGlobal(metadata_llmod, val_ty(llconst).to_ref(), buf.as_ptr())
use llvm::{ContextRef, ModuleRef, ValueRef};
use rustc::dep_graph::{DepGraph, DepGraphSafe, DepNode, DepTrackingMap, DepTrackingMapConfig};
use rustc::hir;
-use rustc::hir::def_id::{DefId, LOCAL_CRATE};
+use rustc::hir::def_id::DefId;
use rustc::traits;
use debuginfo;
use callee;
pub fn translation_items(&self) -> &RefCell<FxHashSet<TransItem<'tcx>>> {
&self.translation_items
}
-
- pub fn metadata_symbol_name(&self) -> String {
- format!("rust_metadata_{}_{}",
- self.tcx().crate_name(LOCAL_CRATE),
- self.tcx().crate_disambiguator(LOCAL_CRATE))
- }
}
impl<'tcx> LocalCrateContext<'tcx> {