forked from M-Labs/nac3
fix debug info
This commit is contained in:
parent
9bfcf36016
commit
3a58708add
@ -26,12 +26,16 @@ pub fn gen_var<'ctx, 'a>(
|
||||
ctx: &mut CodeGenContext<'ctx, 'a>,
|
||||
ty: BasicTypeEnum<'ctx>,
|
||||
) -> Result<PointerValue<'ctx>, String> {
|
||||
let loc = ctx.builder.get_current_debug_location();
|
||||
// put the alloca in init block
|
||||
let current = ctx.builder.get_insert_block().unwrap();
|
||||
// position before the last branching instruction...
|
||||
ctx.builder.position_before(&ctx.init_bb.get_last_instruction().unwrap());
|
||||
let ptr = ctx.builder.build_alloca(ty, "tmp");
|
||||
ctx.builder.position_at_end(current);
|
||||
if let Some(l) = loc {
|
||||
ctx.builder.set_current_debug_location(ctx.ctx, l);
|
||||
}
|
||||
Ok(ptr)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user