@@ -57,7 +57,7 @@ use trans::closure;
57
57
use trans:: common:: { Block , C_bool , C_bytes_in_context , C_i32 , C_integral } ;
58
58
use trans:: common:: { C_null , C_struct_in_context , C_u64 , C_u8 , C_undef } ;
59
59
use trans:: common:: { CrateContext , ExternMap , FunctionContext } ;
60
- use trans:: common:: { NodeInfo , Result } ;
60
+ use trans:: common:: { Result } ;
61
61
use trans:: common:: { node_id_type, return_type_is_void} ;
62
62
use trans:: common:: { tydesc_info, type_is_immediate} ;
63
63
use trans:: common:: { type_is_zero_size, val_ty} ;
@@ -66,7 +66,7 @@ use trans::consts;
66
66
use trans:: context:: SharedCrateContext ;
67
67
use trans:: controlflow;
68
68
use trans:: datum;
69
- use trans:: debuginfo;
69
+ use trans:: debuginfo:: { self , DebugLoc } ;
70
70
use trans:: expr;
71
71
use trans:: foreign;
72
72
use trans:: glue;
@@ -792,7 +792,7 @@ pub fn iter_structural_ty<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
792
792
& * * variant,
793
793
substs,
794
794
& mut f) ;
795
- Br ( variant_cx, next_cx. llbb ) ;
795
+ Br ( variant_cx, next_cx. llbb , DebugLoc :: None ) ;
796
796
}
797
797
cx = next_cx;
798
798
}
@@ -957,7 +957,7 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
957
957
llfn : ValueRef ,
958
958
llargs : & [ ValueRef ] ,
959
959
fn_ty : Ty < ' tcx > ,
960
- call_info : Option < NodeInfo > )
960
+ debug_loc : DebugLoc )
961
961
-> ( ValueRef , Block < ' blk , ' tcx > ) {
962
962
let _icx = push_ctxt ( "invoke_" ) ;
963
963
if bcx. unreachable . get ( ) {
@@ -983,30 +983,25 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
983
983
let normal_bcx = bcx. fcx . new_temp_block ( "normal-return" ) ;
984
984
let landing_pad = bcx. fcx . get_landing_pad ( ) ;
985
985
986
- match call_info {
987
- Some ( info) => debuginfo:: set_source_location ( bcx. fcx , info. id , info. span ) ,
988
- None => debuginfo:: clear_source_location ( bcx. fcx )
989
- } ;
990
-
991
986
let llresult = Invoke ( bcx,
992
987
llfn,
993
988
& llargs[ ] ,
994
989
normal_bcx. llbb ,
995
990
landing_pad,
996
- Some ( attributes) ) ;
991
+ Some ( attributes) ,
992
+ debug_loc) ;
997
993
return ( llresult, normal_bcx) ;
998
994
} else {
999
995
debug ! ( "calling {} at {:?}" , bcx. val_to_string( llfn) , bcx. llbb) ;
1000
996
for & llarg in llargs. iter ( ) {
1001
997
debug ! ( "arg: {}" , bcx. val_to_string( llarg) ) ;
1002
998
}
1003
999
1004
- match call_info {
1005
- Some ( info) => debuginfo:: set_source_location ( bcx. fcx , info. id , info. span ) ,
1006
- None => debuginfo:: clear_source_location ( bcx. fcx )
1007
- } ;
1008
-
1009
- let llresult = Call ( bcx, llfn, & llargs[ ] , Some ( attributes) ) ;
1000
+ let llresult = Call ( bcx,
1001
+ llfn,
1002
+ & llargs[ ] ,
1003
+ Some ( attributes) ,
1004
+ debug_loc) ;
1010
1005
return ( llresult, bcx) ;
1011
1006
}
1012
1007
}
@@ -1094,10 +1089,10 @@ pub fn with_cond<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
1094
1089
let fcx = bcx. fcx ;
1095
1090
let next_cx = fcx. new_temp_block ( "next" ) ;
1096
1091
let cond_cx = fcx. new_temp_block ( "cond" ) ;
1097
- CondBr ( bcx, val, cond_cx. llbb , next_cx. llbb ) ;
1092
+ CondBr ( bcx, val, cond_cx. llbb , next_cx. llbb , DebugLoc :: None ) ;
1098
1093
let after_cx = f ( cond_cx) ;
1099
1094
if !after_cx. terminated . get ( ) {
1100
- Br ( after_cx, next_cx. llbb ) ;
1095
+ Br ( after_cx, next_cx. llbb , DebugLoc :: None ) ;
1101
1096
}
1102
1097
next_cx
1103
1098
}
@@ -1113,7 +1108,7 @@ pub fn call_lifetime_start(cx: Block, ptr: ValueRef) {
1113
1108
let llsize = C_u64 ( ccx, machine:: llsize_of_alloc ( ccx, val_ty ( ptr) . element_type ( ) ) ) ;
1114
1109
let ptr = PointerCast ( cx, ptr, Type :: i8p ( ccx) ) ;
1115
1110
let lifetime_start = ccx. get_intrinsic ( & "llvm.lifetime.start" ) ;
1116
- Call ( cx, lifetime_start, & [ llsize, ptr] , None ) ;
1111
+ Call ( cx, lifetime_start, & [ llsize, ptr] , None , DebugLoc :: None ) ;
1117
1112
}
1118
1113
1119
1114
pub fn call_lifetime_end ( cx : Block , ptr : ValueRef ) {
@@ -1127,7 +1122,7 @@ pub fn call_lifetime_end(cx: Block, ptr: ValueRef) {
1127
1122
let llsize = C_u64 ( ccx, machine:: llsize_of_alloc ( ccx, val_ty ( ptr) . element_type ( ) ) ) ;
1128
1123
let ptr = PointerCast ( cx, ptr, Type :: i8p ( ccx) ) ;
1129
1124
let lifetime_end = ccx. get_intrinsic ( & "llvm.lifetime.end" ) ;
1130
- Call ( cx, lifetime_end, & [ llsize, ptr] , None ) ;
1125
+ Call ( cx, lifetime_end, & [ llsize, ptr] , None , DebugLoc :: None ) ;
1131
1126
}
1132
1127
1133
1128
pub fn call_memcpy ( cx : Block , dst : ValueRef , src : ValueRef , n_bytes : ValueRef , align : u32 ) {
@@ -1144,7 +1139,7 @@ pub fn call_memcpy(cx: Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, a
1144
1139
let size = IntCast ( cx, n_bytes, ccx. int_type ( ) ) ;
1145
1140
let align = C_i32 ( ccx, align as i32 ) ;
1146
1141
let volatile = C_bool ( ccx, false ) ;
1147
- Call ( cx, memcpy, & [ dst_ptr, src_ptr, size, align, volatile] , None ) ;
1142
+ Call ( cx, memcpy, & [ dst_ptr, src_ptr, size, align, volatile] , None , DebugLoc :: None ) ;
1148
1143
}
1149
1144
1150
1145
pub fn memcpy_ty < ' blk , ' tcx > ( bcx : Block < ' blk , ' tcx > ,
@@ -1697,13 +1692,14 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>(
1697
1692
// and builds the return block.
1698
1693
pub fn finish_fn < ' blk , ' tcx > ( fcx : & ' blk FunctionContext < ' blk , ' tcx > ,
1699
1694
last_bcx : Block < ' blk , ' tcx > ,
1700
- retty : ty:: FnOutput < ' tcx > ) {
1695
+ retty : ty:: FnOutput < ' tcx > ,
1696
+ ret_debug_loc : DebugLoc ) {
1701
1697
let _icx = push_ctxt ( "finish_fn" ) ;
1702
1698
1703
1699
let ret_cx = match fcx. llreturn . get ( ) {
1704
1700
Some ( llreturn) => {
1705
1701
if !last_bcx. terminated . get ( ) {
1706
- Br ( last_bcx, llreturn) ;
1702
+ Br ( last_bcx, llreturn, DebugLoc :: None ) ;
1707
1703
}
1708
1704
raw_block ( fcx, false , llreturn)
1709
1705
}
@@ -1713,7 +1709,7 @@ pub fn finish_fn<'blk, 'tcx>(fcx: &'blk FunctionContext<'blk, 'tcx>,
1713
1709
// This shouldn't need to recompute the return type,
1714
1710
// as new_fn_ctxt did it already.
1715
1711
let substd_retty = fcx. monomorphize ( & retty) ;
1716
- build_return_block ( fcx, ret_cx, substd_retty) ;
1712
+ build_return_block ( fcx, ret_cx, substd_retty, ret_debug_loc ) ;
1717
1713
1718
1714
debuginfo:: clear_source_location ( fcx) ;
1719
1715
fcx. cleanup ( ) ;
@@ -1722,10 +1718,11 @@ pub fn finish_fn<'blk, 'tcx>(fcx: &'blk FunctionContext<'blk, 'tcx>,
1722
1718
// Builds the return block for a function.
1723
1719
pub fn build_return_block < ' blk , ' tcx > ( fcx : & FunctionContext < ' blk , ' tcx > ,
1724
1720
ret_cx : Block < ' blk , ' tcx > ,
1725
- retty : ty:: FnOutput < ' tcx > ) {
1721
+ retty : ty:: FnOutput < ' tcx > ,
1722
+ ret_debug_location : DebugLoc ) {
1726
1723
if fcx. llretslotptr . get ( ) . is_none ( ) ||
1727
1724
( !fcx. needs_ret_allocas && fcx. caller_expects_out_pointer ) {
1728
- return RetVoid ( ret_cx) ;
1725
+ return RetVoid ( ret_cx, ret_debug_location ) ;
1729
1726
}
1730
1727
1731
1728
let retslot = if fcx. needs_ret_allocas {
@@ -1755,26 +1752,26 @@ pub fn build_return_block<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>,
1755
1752
if let ty:: FnConverging ( retty) = retty {
1756
1753
store_ty ( ret_cx, retval, get_param ( fcx. llfn , 0 ) , retty) ;
1757
1754
}
1758
- RetVoid ( ret_cx)
1755
+ RetVoid ( ret_cx, ret_debug_location )
1759
1756
} else {
1760
- Ret ( ret_cx, retval)
1757
+ Ret ( ret_cx, retval, ret_debug_location )
1761
1758
}
1762
1759
}
1763
1760
// Otherwise, copy the return value to the ret slot
1764
1761
None => match retty {
1765
1762
ty:: FnConverging ( retty) => {
1766
1763
if fcx. caller_expects_out_pointer {
1767
1764
memcpy_ty ( ret_cx, get_param ( fcx. llfn , 0 ) , retslot, retty) ;
1768
- RetVoid ( ret_cx)
1765
+ RetVoid ( ret_cx, ret_debug_location )
1769
1766
} else {
1770
- Ret ( ret_cx, load_ty ( ret_cx, retslot, retty) )
1767
+ Ret ( ret_cx, load_ty ( ret_cx, retslot, retty) , ret_debug_location )
1771
1768
}
1772
1769
}
1773
1770
ty:: FnDiverging => {
1774
1771
if fcx. caller_expects_out_pointer {
1775
- RetVoid ( ret_cx)
1772
+ RetVoid ( ret_cx, ret_debug_location )
1776
1773
} else {
1777
- Ret ( ret_cx, C_undef ( Type :: nil ( fcx. ccx ) ) )
1774
+ Ret ( ret_cx, C_undef ( Type :: nil ( fcx. ccx ) ) , ret_debug_location )
1778
1775
}
1779
1776
}
1780
1777
}
@@ -1905,7 +1902,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1905
1902
1906
1903
match fcx. llreturn . get ( ) {
1907
1904
Some ( _) => {
1908
- Br ( bcx, fcx. return_exit_block ( ) ) ;
1905
+ Br ( bcx, fcx. return_exit_block ( ) , DebugLoc :: None ) ;
1909
1906
fcx. pop_custom_cleanup_scope ( arg_scope) ;
1910
1907
}
1911
1908
None => {
@@ -1924,8 +1921,11 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1924
1921
}
1925
1922
}
1926
1923
1924
+ let ret_debug_loc = DebugLoc :: At ( fn_cleanup_debug_loc. id ,
1925
+ fn_cleanup_debug_loc. span ) ;
1926
+
1927
1927
// Insert the mandatory first few basic blocks before lltop.
1928
- finish_fn ( & fcx, bcx, output_type) ;
1928
+ finish_fn ( & fcx, bcx, output_type, ret_debug_loc ) ;
1929
1929
}
1930
1930
1931
1931
// trans_fn: creates an LLVM function corresponding to a source language
@@ -1977,7 +1977,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
1977
1977
disr : ty:: Disr ,
1978
1978
args : callee:: CallArgs ,
1979
1979
dest : expr:: Dest ,
1980
- call_info : Option < NodeInfo > )
1980
+ debug_loc : DebugLoc )
1981
1981
-> Result < ' blk , ' tcx > {
1982
1982
1983
1983
let ccx = bcx. fcx . ccx ;
@@ -2016,7 +2016,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
2016
2016
& fields[ ] ,
2017
2017
None ,
2018
2018
expr:: SaveIn ( llresult) ,
2019
- call_info ) ;
2019
+ debug_loc ) ;
2020
2020
}
2021
2021
_ => ccx. sess ( ) . bug ( "expected expr as arguments for variant/struct tuple constructor" )
2022
2022
}
@@ -2027,7 +2027,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
2027
2027
let bcx = match dest {
2028
2028
expr:: SaveIn ( _) => bcx,
2029
2029
expr:: Ignore => {
2030
- glue:: drop_ty ( bcx, llresult, result_ty, call_info )
2030
+ glue:: drop_ty ( bcx, llresult, result_ty, debug_loc )
2031
2031
}
2032
2032
} ;
2033
2033
@@ -2094,7 +2094,7 @@ fn trans_enum_variant_or_tuple_like_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx
2094
2094
adt:: trans_set_discr ( bcx, & * repr, dest, disr) ;
2095
2095
}
2096
2096
2097
- finish_fn ( & fcx, bcx, result_ty) ;
2097
+ finish_fn ( & fcx, bcx, result_ty, DebugLoc :: None ) ;
2098
2098
}
2099
2099
2100
2100
fn enum_variant_size_lint ( ccx : & CrateContext , enum_def : & ast:: EnumDef , sp : Span , id : ast:: NodeId ) {
0 commit comments