Skip to content

Commit 91efb2a

Browse files
debuginfo: Set correct source position for function calls.
1 parent b0100c5 commit 91efb2a

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,11 @@ pub fn trans_external_path(ccx: &mut CrateContext, did: ast::DefId, t: ty::t) ->
875875
}
876876
}
877877
878-
pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
879-
attributes: &[(uint, lib::llvm::Attribute)])
878+
pub fn invoke(bcx: @mut Block,
879+
llfn: ValueRef,
880+
llargs: ~[ValueRef],
881+
attributes: &[(uint, lib::llvm::Attribute)],
882+
call_info: Option<NodeInfo>)
880883
-> (ValueRef, @mut Block) {
881884
let _icx = push_ctxt("invoke_");
882885
if bcx.unreachable {
@@ -899,11 +902,18 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
899902
}
900903
}
901904
let normal_bcx = sub_block(bcx, "normal return");
905+
let landing_pad = get_landing_pad(bcx);
906+
907+
match call_info {
908+
Some(info) => debuginfo::set_source_location(bcx.fcx, info.id, info.span),
909+
None => debuginfo::clear_source_location(bcx.fcx)
910+
};
911+
902912
let llresult = Invoke(bcx,
903913
llfn,
904914
llargs,
905915
normal_bcx.llbb,
906-
get_landing_pad(bcx),
916+
landing_pad,
907917
attributes);
908918
return (llresult, normal_bcx);
909919
} else {
@@ -913,6 +923,12 @@ pub fn invoke(bcx: @mut Block, llfn: ValueRef, llargs: ~[ValueRef],
913923
debug!("arg: {}", llarg);
914924
}
915925
}
926+
927+
match call_info {
928+
Some(info) => debuginfo::set_source_location(bcx.fcx, info.id, info.span),
929+
None => debuginfo::clear_source_location(bcx.fcx)
930+
};
931+
916932
let llresult = Call(bcx, llfn, llargs, attributes);
917933
return (llresult, bcx);
918934
}

src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ pub fn trans_call_inner(in_cx: @mut Block,
697697
}
698698

699699
// Invoke the actual rust fn and update bcx/llresult.
700-
let (llret, b) = base::invoke(bcx, llfn, llargs, attrs);
700+
let (llret, b) = base::invoke(bcx, llfn, llargs, attrs, call_info);
701701
bcx = b;
702702
llresult = llret;
703703

src/librustc/middle/trans/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ pub fn trans_struct_drop(bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did: ast:
429429
add_clean(bcx, llfld_a, fld.mt.ty);
430430
}
431431

432-
let (_, bcx) = invoke(bcx, dtor_addr, args, []);
432+
let (_, bcx) = invoke(bcx, dtor_addr, args, [], None);
433433
bcx
434434
})
435435
}

0 commit comments

Comments
 (0)