use trans::common::{NodeIdAndSpan, CrateContext, FunctionContext, Block};
use trans;
use trans::{monomorphize, type_of};
+use middle::infer;
use middle::ty::{self, Ty};
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
use util::nodemap::{NodeMap, FnvHashMap, FnvHashSet};
}
}
-struct FunctionDebugContextData {
+pub struct FunctionDebugContextData {
scope_map: RefCell<NodeMap<DIScope>>,
fn_metadata: DISubprogram,
argument_counter: Cell<usize>,
}
hir_map::NodeImplItem(impl_item) => {
match impl_item.node {
- hir::MethodImplItem(ref sig, ref body) => {
+ hir::ImplItemKind::Method(ref sig, ref body) => {
if contains_nodebug_attribute(&impl_item.attrs) {
return FunctionDebugContext::FunctionWithoutDebugInfo;
}
// somehow (storing a path in the hir_map, or construct a path using the
// enclosing function).
let (linkage_name, containing_scope) = if has_path {
- let namespace_node = namespace_for_item(cx, DefId::local(fn_ast_id));
+ let fn_ast_def_id = cx.tcx().map.local_def_id(fn_ast_id);
+ let namespace_node = namespace_for_item(cx, fn_ast_def_id);
let linkage_name = namespace_node.mangled_name_of_contained_item(
&function_name[..]);
let containing_scope = namespace_node.scope;
// Return type -- llvm::DIBuilder wants this at index 0
assert_type_for_node_id(cx, fn_ast_id, error_reporting_span);
let fn_type = cx.tcx().node_id_to_type(fn_ast_id);
+ let fn_type = monomorphize::apply_param_substs(cx.tcx(), param_substs, &fn_type);
let (sig, abi) = match fn_type.sty {
ty::TyBareFn(_, ref barefnty) => {
- (cx.tcx().erase_late_bound_regions(&barefnty.sig), barefnty.abi)
+ let sig = cx.tcx().erase_late_bound_regions(&barefnty.sig);
+ let sig = infer::normalize_associated_type(cx.tcx(), &sig);
+ (sig, barefnty.abi)
}
ty::TyClosure(def_id, ref substs) => {
let closure_type = cx.tcx().closure_type(def_id, substs);
- (cx.tcx().erase_late_bound_regions(&closure_type.sig), closure_type.abi)
+ let sig = cx.tcx().erase_late_bound_regions(&closure_type.sig);
+ let sig = infer::normalize_associated_type(cx.tcx(), &sig);
+ (sig, closure_type.abi)
}
_ => cx.sess().bug("get_function_metdata: Expected a function type!")
};
- let sig = monomorphize::apply_param_substs(cx.tcx(), param_substs, &sig);
let mut signature = Vec::with_capacity(sig.inputs.len() + 1);
// Handle other generic parameters
let actual_types = param_substs.types.get_slice(subst::FnSpace);
- for (index, &hir::TyParam{ ident, .. }) in generics.ty_params.iter().enumerate() {
+ for (index, &hir::TyParam{ name, .. }) in generics.ty_params.iter().enumerate() {
let actual_type = actual_types[index];
// Add actual type name to <...> clause of function name
let actual_type_name = compute_debuginfo_type_name(cx,
// Again, only create type information if full debuginfo is enabled
if cx.sess().opts.debuginfo == FullDebugInfo {
let actual_type_metadata = type_metadata(cx, actual_type, codemap::DUMMY_SP);
- let name = CString::new(ident.name.as_str().as_bytes()).unwrap();
+ let name = CString::new(name.as_str().as_bytes()).unwrap();
let param_metadata = unsafe {
llvm::LLVMDIBuilderCreateTemplateTypeParameter(
DIB(cx),