@@ -205,7 +205,8 @@ fn calculate_debuginfo_offset<
205205 _ => {
206206 // Sanity check for `can_use_in_debuginfo`.
207207 assert ! ( !elem. can_use_in_debuginfo( ) ) ;
208- bug ! ( "unsupported var debuginfo projection `{:?}`" , projection)
208+ // TODO: Temporarily disabled for testing purposes.
209+ // bug!("unsupported var debuginfo projection `{:?}`", projection)
209210 }
210211 }
211212 }
@@ -377,6 +378,52 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
377378 }
378379 }
379380
381+ pub ( crate ) fn debug_new_value_to_local (
382+ & self ,
383+ bx : & mut Bx ,
384+ local : mir:: Local ,
385+ base : PlaceValue < Bx :: Value > ,
386+ layout : TyAndLayout < ' tcx > ,
387+ projection : & [ mir:: PlaceElem < ' tcx > ] ,
388+ ) {
389+ let full_debug_info = bx. sess ( ) . opts . debuginfo == DebugInfo :: Full ;
390+ if !full_debug_info {
391+ return ;
392+ }
393+
394+ let vars = match & self . per_local_var_debug_info {
395+ Some ( per_local) => & per_local[ local] ,
396+ None => return ,
397+ } ;
398+
399+ for var in vars. iter ( ) . cloned ( ) {
400+ self . debug_new_value_to_local_as_var ( bx, base, layout, projection, var) ;
401+ }
402+ }
403+
404+ fn debug_new_value_to_local_as_var (
405+ & self ,
406+ bx : & mut Bx ,
407+ base : PlaceValue < Bx :: Value > ,
408+ layout : TyAndLayout < ' tcx > ,
409+ projection : & [ mir:: PlaceElem < ' tcx > ] ,
410+ var : PerLocalVarDebugInfo < ' tcx , Bx :: DIVariable > ,
411+ ) {
412+ let Some ( dbg_var) = var. dbg_var else { return } ;
413+ let Some ( dbg_loc) = self . dbg_loc ( var. source_info ) else { return } ;
414+ let DebugInfoOffset { direct_offset, indirect_offsets, result : _ } =
415+ calculate_debuginfo_offset ( bx, projection, layout) ;
416+ bx. dbg_var_addr (
417+ dbg_var,
418+ dbg_loc,
419+ false ,
420+ base. llval ,
421+ direct_offset,
422+ & indirect_offsets,
423+ var. fragment ,
424+ ) ;
425+ }
426+
380427 fn debug_introduce_local_as_var (
381428 & self ,
382429 bx : & mut Bx ,
@@ -386,7 +433,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
386433 ) {
387434 let Some ( dbg_var) = var. dbg_var else { return } ;
388435 let Some ( dbg_loc) = self . dbg_loc ( var. source_info ) else { return } ;
389-
390436 let DebugInfoOffset { direct_offset, indirect_offsets, result : _ } =
391437 calculate_debuginfo_offset ( bx, var. projection , base. layout ) ;
392438
@@ -421,6 +467,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
421467 bx. dbg_var_addr (
422468 dbg_var,
423469 dbg_loc,
470+ true ,
424471 alloca. val . llval ,
425472 Size :: ZERO ,
426473 & [ Size :: ZERO ] ,
@@ -430,6 +477,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
430477 bx. dbg_var_addr (
431478 dbg_var,
432479 dbg_loc,
480+ true ,
433481 base. val . llval ,
434482 direct_offset,
435483 & indirect_offsets,
@@ -455,7 +503,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
455503 let base = FunctionCx :: spill_operand_to_stack ( operand, Some ( name) , bx) ;
456504 bx. clear_dbg_loc ( ) ;
457505
458- bx. dbg_var_addr ( dbg_var, dbg_loc, base. val . llval , Size :: ZERO , & [ ] , fragment) ;
506+ bx. dbg_var_addr ( dbg_var, dbg_loc, true , base. val . llval , Size :: ZERO , & [ ] , fragment) ;
459507 }
460508 }
461509 }
0 commit comments