}
pub fn trans_instance<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, instance: Instance<'tcx>) {
- let instance = inline::maybe_inline_instance(ccx, instance);
+ let local_instance = inline::maybe_inline_instance(ccx, instance);
- let fn_node_id = ccx.tcx().map.as_local_node_id(instance.def).unwrap();
+ let fn_node_id = ccx.tcx().map.as_local_node_id(local_instance.def).unwrap();
let _s = StatRecorder::new(ccx, ccx.tcx().node_path_str(fn_node_id));
debug!("trans_instance(instance={:?})", instance);
let sig = ccx.tcx().normalize_associated_type(&sig);
let abi = fn_ty.fn_abi();
- let lldecl = match ccx.instances().borrow().get(&instance) {
+ let lldecl = match ccx.instances().borrow().get(&local_instance) {
Some(&val) => val,
None => bug!("Instance `{:?}` not already declared", instance)
};
let has_fixed_linkage = linkage_fixed_explicitly.contains(&name_cow);
if !is_referenced_somewhere && !is_reachable && !has_fixed_linkage {
- llvm::SetLinkage(val, llvm::InternalLinkage);
- llvm::SetDLLStorageClass(val, llvm::DefaultStorageClass);
+ llvm::LLVMSetLinkage(val, llvm::InternalLinkage);
+ llvm::LLVMSetDLLStorageClass(val,
+ llvm::DLLStorageClass::Default);
llvm::UnsetComdat(val);
}
}
imp_name.as_ptr() as *const _);
let init = llvm::LLVMConstBitCast(val, i8p_ty.to_ref());
llvm::LLVMSetInitializer(imp, init);
- llvm::SetLinkage(imp, llvm::ExternalLinkage);
+ llvm::LLVMSetLinkage(imp, llvm::ExternalLinkage);
}
}
}
use abi::Abi;
use common::{NodeIdAndSpan, CrateContext, FunctionContext, Block, BlockAndBuilder};
+use inline;
use monomorphize::{self, Instance};
use rustc::ty::{self, Ty};
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
impl<'tcx> CrateDebugContext<'tcx> {
pub fn new(llmod: ModuleRef) -> CrateDebugContext<'tcx> {
debug!("CrateDebugContext::new");
- let builder = unsafe { llvm::LLVMDIBuilderCreate(llmod) };
+ let builder = unsafe { llvm::LLVMRustDIBuilderCreate(llmod) };
// DIBuilder inherits context from the module, so we'd better use the same one
let llcontext = unsafe { llvm::LLVMGetModuleContext(llmod) };
return CrateDebugContext {
}
unsafe {
- llvm::LLVMDIBuilderFinalize(DIB(cx));
- llvm::LLVMDIBuilderDispose(DIB(cx));
+ llvm::LLVMRustDIBuilderFinalize(DIB(cx));
+ llvm::LLVMRustDIBuilderDispose(DIB(cx));
// Debuginfo generation in LLVM by default uses a higher
// version of dwarf than OS X currently understands. We can
// instruct LLVM to emit an older version of dwarf, however,
// Do this here already, in case we do an early exit from this function.
source_loc::set_debug_location(cx, None, UnknownLocation);
+ let instance = inline::maybe_inline_instance(cx, instance);
let (containing_scope, span) = get_containing_scope_and_span(cx, instance);
// This can be the case for functions inlined from another crate
let function_type_metadata = unsafe {
let fn_signature = get_function_signature(cx, sig, abi);
- llvm::LLVMDIBuilderCreateSubroutineType(DIB(cx), file_metadata, fn_signature)
+ llvm::LLVMRustDIBuilderCreateSubroutineType(DIB(cx), file_metadata, fn_signature)
};
// Find the enclosing function, in case this is a closure.
let linkage_name = CString::new(linkage_name).unwrap();
let fn_metadata = unsafe {
- llvm::LLVMDIBuilderCreateFunction(
+ llvm::LLVMRustDIBuilderCreateFunction(
DIB(cx),
containing_scope,
function_name.as_ptr(),
let actual_type_metadata = type_metadata(cx, actual_type, syntax_pos::DUMMY_SP);
let name = CString::new(param.name.as_str().as_bytes()).unwrap();
unsafe {
- llvm::LLVMDIBuilderCreateTemplateTypeParameter(
+ llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
DIB(cx),
ptr::null_mut(),
name.as_ptr(),
(DirectVariable { alloca }, address_operations) |
(IndirectVariable {alloca, address_operations}, _) => {
let metadata = unsafe {
- llvm::LLVMDIBuilderCreateVariable(
+ llvm::LLVMRustDIBuilderCreateVariable(
DIB(cx),
dwarf_tag,
scope_metadata,
InternalDebugLocation::new(scope_metadata, loc.line, loc.col.to_usize()));
unsafe {
let debug_loc = llvm::LLVMGetCurrentDebugLocation(cx.raw_builder());
- let instr = llvm::LLVMDIBuilderInsertDeclareAtEnd(
+ let instr = llvm::LLVMRustDIBuilderInsertDeclareAtEnd(
DIB(cx),
alloca,
metadata,