@@ -5,7 +5,7 @@ use rustc_codegen_ssa::mir::debuginfo::VariableKind::*;
5
5
use self :: metadata:: { file_metadata, type_di_node} ;
6
6
use self :: metadata:: { UNKNOWN_COLUMN_NUMBER , UNKNOWN_LINE_NUMBER } ;
7
7
use self :: namespace:: mangled_name_of_instance;
8
- use self :: utils:: { create_DIArray, debug_context , is_node_local_to_unit, DIB } ;
8
+ use self :: utils:: { create_DIArray, is_node_local_to_unit, DIB } ;
9
9
10
10
use crate :: abi:: FnAbi ;
11
11
use crate :: builder:: Builder ;
@@ -67,8 +67,6 @@ pub struct CodegenUnitDebugContext<'ll, 'tcx> {
67
67
type_map : metadata:: TypeMap < ' ll , ' tcx > ,
68
68
namespace_map : RefCell < DefIdMap < & ' ll DIScope > > ,
69
69
recursion_marker_type : OnceCell < & ' ll DIType > ,
70
- /// Maps a variable (name, scope, kind (argument or local), span) to its debug information.
71
- variables : RefCell < FxHashMap < ( Symbol , & ' ll DIScope , VariableKind , Span ) , & ' ll DIVariable > > ,
72
70
}
73
71
74
72
impl Drop for CodegenUnitDebugContext < ' _ , ' _ > {
@@ -93,7 +91,6 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> {
93
91
type_map : Default :: default ( ) ,
94
92
namespace_map : RefCell :: new ( Default :: default ( ) ) ,
95
93
recursion_marker_type : OnceCell :: new ( ) ,
96
- variables : RefCell :: new ( Default :: default ( ) ) ,
97
94
}
98
95
}
99
96
@@ -295,7 +292,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
295
292
fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
296
293
llfn : & ' ll Value ,
297
294
mir : & mir:: Body < ' tcx > ,
298
- ) -> Option < FunctionDebugContext < ' tcx , & ' ll DIScope , & ' ll DILocation > > {
295
+ ) -> Option < FunctionDebugContext < & ' ll DIScope , & ' ll DILocation > > {
299
296
if self . sess ( ) . opts . debuginfo == DebugInfo :: None {
300
297
return None ;
301
298
}
@@ -307,11 +304,8 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
307
304
file_start_pos : BytePos ( 0 ) ,
308
305
file_end_pos : BytePos ( 0 ) ,
309
306
} ;
310
- let mut fn_debug_context = FunctionDebugContext {
311
- scopes : IndexVec :: from_elem ( empty_scope, & mir. source_scopes ) ,
312
- inlined_function_scopes : Default :: default ( ) ,
313
- lexical_blocks : Default :: default ( ) ,
314
- } ;
307
+ let mut fn_debug_context =
308
+ FunctionDebugContext { scopes : IndexVec :: from_elem ( empty_scope, & mir. source_scopes ) } ;
315
309
316
310
// Fill in all the scopes, with the information from the MIR body.
317
311
compute_mir_scopes ( self , instance, mir, & mut fn_debug_context) ;
@@ -612,39 +606,33 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
612
606
variable_kind : VariableKind ,
613
607
span : Span ,
614
608
) -> & ' ll DIVariable {
615
- debug_context ( self )
616
- . variables
617
- . borrow_mut ( )
618
- . entry ( ( variable_name, scope_metadata, variable_kind, span) )
619
- . or_insert_with ( || {
620
- let loc = self . lookup_debug_loc ( span. lo ( ) ) ;
621
- let file_metadata = file_metadata ( self , & loc. file ) ;
622
-
623
- let type_metadata = type_di_node ( self , variable_type) ;
624
-
625
- let ( argument_index, dwarf_tag) = match variable_kind {
626
- ArgumentVariable ( index) => ( index as c_uint , DW_TAG_arg_variable ) ,
627
- LocalVariable => ( 0 , DW_TAG_auto_variable ) ,
628
- } ;
629
- let align = self . align_of ( variable_type) ;
630
-
631
- let name = variable_name. as_str ( ) ;
632
- unsafe {
633
- llvm:: LLVMRustDIBuilderCreateVariable (
634
- DIB ( self ) ,
635
- dwarf_tag,
636
- scope_metadata,
637
- name. as_ptr ( ) . cast ( ) ,
638
- name. len ( ) ,
639
- file_metadata,
640
- loc. line ,
641
- type_metadata,
642
- true ,
643
- DIFlags :: FlagZero ,
644
- argument_index,
645
- align. bytes ( ) as u32 ,
646
- )
647
- }
648
- } )
609
+ let loc = self . lookup_debug_loc ( span. lo ( ) ) ;
610
+ let file_metadata = file_metadata ( self , & loc. file ) ;
611
+
612
+ let type_metadata = type_di_node ( self , variable_type) ;
613
+
614
+ let ( argument_index, dwarf_tag) = match variable_kind {
615
+ ArgumentVariable ( index) => ( index as c_uint , DW_TAG_arg_variable ) ,
616
+ LocalVariable => ( 0 , DW_TAG_auto_variable ) ,
617
+ } ;
618
+ let align = self . align_of ( variable_type) ;
619
+
620
+ let name = variable_name. as_str ( ) ;
621
+ unsafe {
622
+ llvm:: LLVMRustDIBuilderCreateVariable (
623
+ DIB ( self ) ,
624
+ dwarf_tag,
625
+ scope_metadata,
626
+ name. as_ptr ( ) . cast ( ) ,
627
+ name. len ( ) ,
628
+ file_metadata,
629
+ loc. line ,
630
+ type_metadata,
631
+ true ,
632
+ DIFlags :: FlagZero ,
633
+ argument_index,
634
+ align. bytes ( ) as u32 ,
635
+ )
636
+ }
649
637
}
650
638
}
0 commit comments