From f2c38d42b9957fed6cd7c214906730d4b3398e01 Mon Sep 17 00:00:00 2001 From: sofia Date: Sat, 19 Jul 2025 13:56:41 +0300 Subject: [PATCH] Add variable debug declarations to all variables --- reid/src/codegen.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/reid/src/codegen.rs b/reid/src/codegen.rs index 1e4a29a..a52b711 100644 --- a/reid/src/codegen.rs +++ b/reid/src/codegen.rs @@ -428,7 +428,7 @@ impl mir::Statement { .unwrap() .maybe_location(&mut scope.block, location); - scope + let store = scope .block .build(Instr::Store(alloca, value)) .unwrap() @@ -447,7 +447,7 @@ impl mir::Statement { StackValueKind::Immutable(_) => {} StackValueKind::Mutable(_) => { let location = self.1.into_debug(scope.tokens).unwrap(); - debug.info.metadata( + let var = debug.info.metadata( &debug.scope, DebugMetadata::LocalVar(DebugLocalVariable { name: name.clone(), @@ -458,16 +458,15 @@ impl mir::Statement { flags: DwarfFlags, }), ); - // dbg!(&store); - // store.add_record( - // &mut scope.block, - // InstructionDebugRecordData { - // variable: var, - // location, - // kind: DebugRecordKind::Declare(value), - // scope: debug.scope, - // }, - // ); + store.add_record( + &mut scope.block, + InstructionDebugRecordData { + variable: var, + location, + kind: DebugRecordKind::Declare(value), + scope: debug.scope, + }, + ); } StackValueKind::Any(_) => {} }