debuginfo: Set correct source position for function calls.

This commit is contained in:
Michael Woerister 2013-12-13 17:46:10 +01:00
parent b0100c5a0f
commit 91efb2a67f
3 changed files with 21 additions and 5 deletions

View file

@ -875,8 +875,11 @@ pub fn trans_external_path(ccx: &mut CrateContext, did: ast::DefId, t: ty::t) ->
}
}
pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
attributes: &[(uint, lib::llvm::Attribute)])
pub fn invoke(bcx: @mut Block,
llfn: ValueRef,
llargs: ~[ValueRef],
attributes: &[(uint, lib::llvm::Attribute)],
call_info: Option<NodeInfo>)
-> (ValueRef, @mut Block) {
let _icx = push_ctxt("invoke_");
if bcx.unreachable {
@ -899,11 +902,18 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
}
}
let normal_bcx = sub_block(bcx, "normal return");
let landing_pad = get_landing_pad(bcx);
match call_info {
Some(info) => debuginfo::set_source_location(bcx.fcx, info.id, info.span),
None => debuginfo::clear_source_location(bcx.fcx)
};
let llresult = Invoke(bcx,
llfn,
llargs,
normal_bcx.llbb,
get_landing_pad(bcx),
landing_pad,
attributes);
return (llresult, normal_bcx);
} else {
@ -913,6 +923,12 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
debug!("arg: {}", llarg);
}
}
match call_info {
Some(info) => debuginfo::set_source_location(bcx.fcx, info.id, info.span),
None => debuginfo::clear_source_location(bcx.fcx)
};
let llresult = Call(bcx, llfn, llargs, attributes);
return (llresult, bcx);
}

View file

@ -697,7 +697,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
}
// Invoke the actual rust fn and update bcx/llresult.
let (llret, b) = base::invoke(bcx, llfn, llargs, attrs);
let (llret, b) = base::invoke(bcx, llfn, llargs, attrs, call_info);
bcx = b;
llresult = llret;

View file

@ -429,7 +429,7 @@ pub fn trans_struct_drop(bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did: ast:
add_clean(bcx, llfld_a, fld.mt.ty);
}
let (_, bcx) = invoke(bcx, dtor_addr, args, []);
let (_, bcx) = invoke(bcx, dtor_addr, args, [], None);
bcx
})
}