@@ -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+
19261936fn 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