Skip to content

Commit 903a247

Browse files
---
yaml --- r: 145107 b: refs/heads/try2 c: 206cc59 h: refs/heads/master i: 145105: 887566e 145103: d09c50c v: v3
1 parent b603b80 commit 903a247

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: bf37de9fc675a90d12c37fd0e8acdfe4107545f9
8+
refs/heads/try2: 206cc59f46f6e7b4f91ebe8fdfe4dae83a1fa703
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
573573
_,
574574
_,
575575
_) => {
576-
(ident, fn_decl, generics, None, span)
576+
//(ident, fn_decl, generics, None, span)
577+
return FunctionWithoutDebugInfo;
577578
}
578579
ast_map::node_variant(*) |
579580
ast_map::node_struct_ctor(*) => {
@@ -591,7 +592,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
591592
let file_metadata = file_metadata(cx, loc.file.name);
592593

593594
let function_type_metadata = unsafe {
594-
let fn_signature = get_function_signature(cx, fn_ast_id, fn_decl, param_substs);
595+
let fn_signature = get_function_signature(cx, fn_ast_id, fn_decl, param_substs, span);
595596
llvm::LLVMDIBuilderCreateSubroutineType(DIB(cx), file_metadata, fn_signature)
596597
};
597598

@@ -670,7 +671,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
670671
fn get_function_signature(cx: &mut CrateContext,
671672
fn_ast_id: ast::NodeId,
672673
fn_decl: &ast::fn_decl,
673-
param_substs: Option<@param_substs>) -> DIArray {
674+
param_substs: Option<@param_substs>,
675+
error_span: Span) -> DIArray {
674676
if !cx.sess.opts.extra_debuginfo {
675677
return create_DIArray(DIB(cx), []);
676678
}
@@ -683,6 +685,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
683685
signature.push(ptr::null());
684686
}
685687
_ => {
688+
assert_type_for_node_id(cx, fn_ast_id, error_span);
689+
686690
let return_type = ty::node_id_to_type(cx.tcx, fn_ast_id);
687691
let return_type = match param_substs {
688692
None => return_type,
@@ -697,6 +701,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
697701

698702
// Arguments types
699703
for arg in fn_decl.inputs.iter() {
704+
assert_type_for_node_id(cx, arg.pat.id, arg.pat.span);
700705
let arg_type = ty::node_id_to_type(cx.tcx, arg.pat.id);
701706
let arg_type = match param_substs {
702707
None => arg_type,
@@ -1820,8 +1825,7 @@ fn type_metadata(cx: &mut CrateContext,
18201825
tuple_metadata(cx, t, *elements, usage_site_span)
18211826
},
18221827
ty::ty_opaque_box => {
1823-
cx.sess.span_note(usage_site_span, "debuginfo for ty_opaque_box NYI");
1824-
unimplemented_type_metadata(cx, t)
1828+
create_pointer_to_box_metadata(cx, t, ty::mk_nil())
18251829
}
18261830
_ => cx.sess.bug(fmt!("debuginfo: unexpected type in type_metadata: %?", sty))
18271831
};
@@ -1923,6 +1927,12 @@ fn fn_should_be_ignored(fcx: &FunctionContext) -> bool {
19231927
}
19241928
}
19251929

1930+
fn assert_type_for_node_id(cx: &CrateContext, node_id: ast::NodeId, error_span: Span) {
1931+
if !cx.tcx.node_types.contains_key(&(node_id as uint)) {
1932+
cx.sess.span_bug(error_span, "debuginfo: Could not find type for node id!");
1933+
}
1934+
}
1935+
19261936
fn get_namespace_and_span_for_item(cx: &mut CrateContext,
19271937
def_id: ast::DefId,
19281938
warning_span: Span)
@@ -2618,6 +2628,12 @@ impl<'self> visit::Visitor<()> for NamespaceVisitor<'self> {
26182628
visit::walk_item(self, item, ());
26192629
}
26202630

2631+
fn visit_foreign_item(&mut self, item: @ast::foreign_item, _: ()) {
2632+
debug_context(self.crate_context)
2633+
.local_namespace_map
2634+
.insert(item.id, *self.scope_stack.last());
2635+
}
2636+
26212637
fn visit_fn(&mut self,
26222638
_: &visit::fn_kind,
26232639
_: &ast::fn_decl,

0 commit comments

Comments
 (0)