@@ -573,7 +573,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
573
573
_,
574
574
_,
575
575
_) => {
576
- ( ident, fn_decl, generics, None , span)
576
+ //(ident, fn_decl, generics, None, span)
577
+ return FunctionWithoutDebugInfo ;
577
578
}
578
579
ast_map:: node_variant( * ) |
579
580
ast_map:: node_struct_ctor( * ) => {
@@ -591,7 +592,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
591
592
let file_metadata = file_metadata ( cx, loc. file . name ) ;
592
593
593
594
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 ) ;
595
596
llvm:: LLVMDIBuilderCreateSubroutineType ( DIB ( cx) , file_metadata, fn_signature)
596
597
} ;
597
598
@@ -670,7 +671,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
670
671
fn get_function_signature ( cx : & mut CrateContext ,
671
672
fn_ast_id : ast:: NodeId ,
672
673
fn_decl : & ast:: fn_decl ,
673
- param_substs : Option < @param_substs > ) -> DIArray {
674
+ param_substs : Option < @param_substs > ,
675
+ error_span : Span ) -> DIArray {
674
676
if !cx. sess . opts . extra_debuginfo {
675
677
return create_DIArray ( DIB ( cx) , [ ] ) ;
676
678
}
@@ -683,6 +685,8 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
683
685
signature. push ( ptr:: null ( ) ) ;
684
686
}
685
687
_ => {
688
+ assert_type_for_node_id ( cx, fn_ast_id, error_span) ;
689
+
686
690
let return_type = ty:: node_id_to_type ( cx. tcx , fn_ast_id) ;
687
691
let return_type = match param_substs {
688
692
None => return_type,
@@ -697,6 +701,7 @@ pub fn create_function_debug_context(cx: &mut CrateContext,
697
701
698
702
// Arguments types
699
703
for arg in fn_decl. inputs . iter ( ) {
704
+ assert_type_for_node_id ( cx, arg. pat . id , arg. pat . span ) ;
700
705
let arg_type = ty:: node_id_to_type ( cx. tcx , arg. pat . id ) ;
701
706
let arg_type = match param_substs {
702
707
None => arg_type,
@@ -1820,8 +1825,7 @@ fn type_metadata(cx: &mut CrateContext,
1820
1825
tuple_metadata ( cx, t, * elements, usage_site_span)
1821
1826
} ,
1822
1827
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 ( ) )
1825
1829
}
1826
1830
_ => cx. sess . bug ( fmt ! ( "debuginfo: unexpected type in type_metadata: %?" , sty) )
1827
1831
} ;
@@ -1923,6 +1927,12 @@ fn fn_should_be_ignored(fcx: &FunctionContext) -> bool {
1923
1927
}
1924
1928
}
1925
1929
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
+
1926
1936
fn get_namespace_and_span_for_item ( cx : & mut CrateContext ,
1927
1937
def_id : ast:: DefId ,
1928
1938
warning_span : Span )
@@ -2618,6 +2628,12 @@ impl<'self> visit::Visitor<()> for NamespaceVisitor<'self> {
2618
2628
visit:: walk_item ( self , item, ( ) ) ;
2619
2629
}
2620
2630
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
+
2621
2637
fn visit_fn ( & mut self ,
2622
2638
_: & visit:: fn_kind ,
2623
2639
_: & ast:: fn_decl ,
0 commit comments