@@ -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;
@@ -780,7 +780,7 @@ pub fn iter_structural_ty<'blk, 'tcx, F>(cx: Block<'blk, 'tcx>,
780
780
& * * variant,
781
781
substs,
782
782
& mut f) ;
783
- Br ( variant_cx, next_cx. llbb ) ;
783
+ Br ( variant_cx, next_cx. llbb , DebugLoc :: None ) ;
784
784
}
785
785
cx = next_cx;
786
786
}
@@ -945,7 +945,7 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
945
945
llfn : ValueRef ,
946
946
llargs : & [ ValueRef ] ,
947
947
fn_ty : Ty < ' tcx > ,
948
- call_info : Option < NodeInfo > )
948
+ debug_loc : DebugLoc )
949
949
-> ( ValueRef , Block < ' blk , ' tcx > ) {
950
950
let _icx = push_ctxt ( "invoke_" ) ;
951
951
if bcx. unreachable . get ( ) {
@@ -971,30 +971,25 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
971
971
let normal_bcx = bcx. fcx . new_temp_block ( "normal-return" ) ;
972
972
let landing_pad = bcx. fcx . get_landing_pad ( ) ;
973
973
974
- match call_info {
975
- Some ( info) => debuginfo:: set_source_location ( bcx. fcx , info. id , info. span ) ,
976
- None => debuginfo:: clear_source_location ( bcx. fcx )
977
- } ;
978
-
979
974
let llresult = Invoke ( bcx,
980
975
llfn,
981
976
& llargs[ ] ,
982
977
normal_bcx. llbb ,
983
978
landing_pad,
984
- Some ( attributes) ) ;
979
+ Some ( attributes) ,
980
+ debug_loc) ;
985
981
return ( llresult, normal_bcx) ;
986
982
} else {
987
983
debug ! ( "calling {} at {:?}" , bcx. val_to_string( llfn) , bcx. llbb) ;
988
984
for & llarg in llargs. iter ( ) {
989
985
debug ! ( "arg: {}" , bcx. val_to_string( llarg) ) ;
990
986
}
991
987
992
- match call_info {
993
- Some ( info) => debuginfo:: set_source_location ( bcx. fcx , info. id , info. span ) ,
994
- None => debuginfo:: clear_source_location ( bcx. fcx )
995
- } ;
996
-
997
- let llresult = Call ( bcx, llfn, & llargs[ ] , Some ( attributes) ) ;
988
+ let llresult = Call ( bcx,
989
+ llfn,
990
+ & llargs[ ] ,
991
+ Some ( attributes) ,
992
+ debug_loc) ;
998
993
return ( llresult, bcx) ;
999
994
}
1000
995
}
@@ -1082,10 +1077,10 @@ pub fn with_cond<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
1082
1077
let fcx = bcx. fcx ;
1083
1078
let next_cx = fcx. new_temp_block ( "next" ) ;
1084
1079
let cond_cx = fcx. new_temp_block ( "cond" ) ;
1085
- CondBr ( bcx, val, cond_cx. llbb , next_cx. llbb ) ;
1080
+ CondBr ( bcx, val, cond_cx. llbb , next_cx. llbb , DebugLoc :: None ) ;
1086
1081
let after_cx = f ( cond_cx) ;
1087
1082
if !after_cx. terminated . get ( ) {
1088
- Br ( after_cx, next_cx. llbb ) ;
1083
+ Br ( after_cx, next_cx. llbb , DebugLoc :: None ) ;
1089
1084
}
1090
1085
next_cx
1091
1086
}
@@ -1101,7 +1096,7 @@ pub fn call_lifetime_start(cx: Block, ptr: ValueRef) {
1101
1096
let llsize = C_u64 ( ccx, machine:: llsize_of_alloc ( ccx, val_ty ( ptr) . element_type ( ) ) ) ;
1102
1097
let ptr = PointerCast ( cx, ptr, Type :: i8p ( ccx) ) ;
1103
1098
let lifetime_start = ccx. get_intrinsic ( & "llvm.lifetime.start" ) ;
1104
- Call ( cx, lifetime_start, & [ llsize, ptr] , None ) ;
1099
+ Call ( cx, lifetime_start, & [ llsize, ptr] , None , DebugLoc :: None ) ;
1105
1100
}
1106
1101
1107
1102
pub fn call_lifetime_end ( cx : Block , ptr : ValueRef ) {
@@ -1115,7 +1110,7 @@ pub fn call_lifetime_end(cx: Block, ptr: ValueRef) {
1115
1110
let llsize = C_u64 ( ccx, machine:: llsize_of_alloc ( ccx, val_ty ( ptr) . element_type ( ) ) ) ;
1116
1111
let ptr = PointerCast ( cx, ptr, Type :: i8p ( ccx) ) ;
1117
1112
let lifetime_end = ccx. get_intrinsic ( & "llvm.lifetime.end" ) ;
1118
- Call ( cx, lifetime_end, & [ llsize, ptr] , None ) ;
1113
+ Call ( cx, lifetime_end, & [ llsize, ptr] , None , DebugLoc :: None ) ;
1119
1114
}
1120
1115
1121
1116
pub fn call_memcpy ( cx : Block , dst : ValueRef , src : ValueRef , n_bytes : ValueRef , align : u32 ) {
@@ -1132,7 +1127,7 @@ pub fn call_memcpy(cx: Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, a
1132
1127
let size = IntCast ( cx, n_bytes, ccx. int_type ( ) ) ;
1133
1128
let align = C_i32 ( ccx, align as i32 ) ;
1134
1129
let volatile = C_bool ( ccx, false ) ;
1135
- Call ( cx, memcpy, & [ dst_ptr, src_ptr, size, align, volatile] , None ) ;
1130
+ Call ( cx, memcpy, & [ dst_ptr, src_ptr, size, align, volatile] , None , DebugLoc :: None ) ;
1136
1131
}
1137
1132
1138
1133
pub fn memcpy_ty < ' blk , ' tcx > ( bcx : Block < ' blk , ' tcx > ,
@@ -1685,13 +1680,14 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>(
1685
1680
// and builds the return block.
1686
1681
pub fn finish_fn < ' blk , ' tcx > ( fcx : & ' blk FunctionContext < ' blk , ' tcx > ,
1687
1682
last_bcx : Block < ' blk , ' tcx > ,
1688
- retty : ty:: FnOutput < ' tcx > ) {
1683
+ retty : ty:: FnOutput < ' tcx > ,
1684
+ ret_debug_loc : DebugLoc ) {
1689
1685
let _icx = push_ctxt ( "finish_fn" ) ;
1690
1686
1691
1687
let ret_cx = match fcx. llreturn . get ( ) {
1692
1688
Some ( llreturn) => {
1693
1689
if !last_bcx. terminated . get ( ) {
1694
- Br ( last_bcx, llreturn) ;
1690
+ Br ( last_bcx, llreturn, DebugLoc :: None ) ;
1695
1691
}
1696
1692
raw_block ( fcx, false , llreturn)
1697
1693
}
@@ -1701,7 +1697,7 @@ pub fn finish_fn<'blk, 'tcx>(fcx: &'blk FunctionContext<'blk, 'tcx>,
1701
1697
// This shouldn't need to recompute the return type,
1702
1698
// as new_fn_ctxt did it already.
1703
1699
let substd_retty = fcx. monomorphize ( & retty) ;
1704
- build_return_block ( fcx, ret_cx, substd_retty) ;
1700
+ build_return_block ( fcx, ret_cx, substd_retty, ret_debug_loc ) ;
1705
1701
1706
1702
debuginfo:: clear_source_location ( fcx) ;
1707
1703
fcx. cleanup ( ) ;
@@ -1710,10 +1706,11 @@ pub fn finish_fn<'blk, 'tcx>(fcx: &'blk FunctionContext<'blk, 'tcx>,
1710
1706
// Builds the return block for a function.
1711
1707
pub fn build_return_block < ' blk , ' tcx > ( fcx : & FunctionContext < ' blk , ' tcx > ,
1712
1708
ret_cx : Block < ' blk , ' tcx > ,
1713
- retty : ty:: FnOutput < ' tcx > ) {
1709
+ retty : ty:: FnOutput < ' tcx > ,
1710
+ ret_debug_location : DebugLoc ) {
1714
1711
if fcx. llretslotptr . get ( ) . is_none ( ) ||
1715
1712
( !fcx. needs_ret_allocas && fcx. caller_expects_out_pointer ) {
1716
- return RetVoid ( ret_cx) ;
1713
+ return RetVoid ( ret_cx, ret_debug_location ) ;
1717
1714
}
1718
1715
1719
1716
let retslot = if fcx. needs_ret_allocas {
@@ -1743,26 +1740,26 @@ pub fn build_return_block<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>,
1743
1740
if let ty:: FnConverging ( retty) = retty {
1744
1741
store_ty ( ret_cx, retval, get_param ( fcx. llfn , 0 ) , retty) ;
1745
1742
}
1746
- RetVoid ( ret_cx)
1743
+ RetVoid ( ret_cx, ret_debug_location )
1747
1744
} else {
1748
- Ret ( ret_cx, retval)
1745
+ Ret ( ret_cx, retval, ret_debug_location )
1749
1746
}
1750
1747
}
1751
1748
// Otherwise, copy the return value to the ret slot
1752
1749
None => match retty {
1753
1750
ty:: FnConverging ( retty) => {
1754
1751
if fcx. caller_expects_out_pointer {
1755
1752
memcpy_ty ( ret_cx, get_param ( fcx. llfn , 0 ) , retslot, retty) ;
1756
- RetVoid ( ret_cx)
1753
+ RetVoid ( ret_cx, ret_debug_location )
1757
1754
} else {
1758
- Ret ( ret_cx, load_ty ( ret_cx, retslot, retty) )
1755
+ Ret ( ret_cx, load_ty ( ret_cx, retslot, retty) , ret_debug_location )
1759
1756
}
1760
1757
}
1761
1758
ty:: FnDiverging => {
1762
1759
if fcx. caller_expects_out_pointer {
1763
- RetVoid ( ret_cx)
1760
+ RetVoid ( ret_cx, ret_debug_location )
1764
1761
} else {
1765
- Ret ( ret_cx, C_undef ( Type :: nil ( fcx. ccx ) ) )
1762
+ Ret ( ret_cx, C_undef ( Type :: nil ( fcx. ccx ) ) , ret_debug_location )
1766
1763
}
1767
1764
}
1768
1765
}
@@ -1893,7 +1890,7 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1893
1890
1894
1891
match fcx. llreturn . get ( ) {
1895
1892
Some ( _) => {
1896
- Br ( bcx, fcx. return_exit_block ( ) ) ;
1893
+ Br ( bcx, fcx. return_exit_block ( ) , DebugLoc :: None ) ;
1897
1894
fcx. pop_custom_cleanup_scope ( arg_scope) ;
1898
1895
}
1899
1896
None => {
@@ -1912,8 +1909,11 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1912
1909
}
1913
1910
}
1914
1911
1912
+ let ret_debug_loc = DebugLoc :: At ( fn_cleanup_debug_loc. id ,
1913
+ fn_cleanup_debug_loc. span ) ;
1914
+
1915
1915
// Insert the mandatory first few basic blocks before lltop.
1916
- finish_fn ( & fcx, bcx, output_type) ;
1916
+ finish_fn ( & fcx, bcx, output_type, ret_debug_loc ) ;
1917
1917
}
1918
1918
1919
1919
// trans_fn: creates an LLVM function corresponding to a source language
@@ -1965,7 +1965,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
1965
1965
disr : ty:: Disr ,
1966
1966
args : callee:: CallArgs ,
1967
1967
dest : expr:: Dest ,
1968
- call_info : Option < NodeInfo > )
1968
+ debug_loc : DebugLoc )
1969
1969
-> Result < ' blk , ' tcx > {
1970
1970
1971
1971
let ccx = bcx. fcx . ccx ;
@@ -2004,7 +2004,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
2004
2004
& fields[ ] ,
2005
2005
None ,
2006
2006
expr:: SaveIn ( llresult) ,
2007
- call_info ) ;
2007
+ debug_loc ) ;
2008
2008
}
2009
2009
_ => ccx. sess ( ) . bug ( "expected expr as arguments for variant/struct tuple constructor" )
2010
2010
}
@@ -2015,7 +2015,7 @@ pub fn trans_named_tuple_constructor<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
2015
2015
let bcx = match dest {
2016
2016
expr:: SaveIn ( _) => bcx,
2017
2017
expr:: Ignore => {
2018
- glue:: drop_ty ( bcx, llresult, result_ty, call_info )
2018
+ glue:: drop_ty ( bcx, llresult, result_ty, debug_loc )
2019
2019
}
2020
2020
} ;
2021
2021
@@ -2082,7 +2082,7 @@ fn trans_enum_variant_or_tuple_like_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx
2082
2082
adt:: trans_set_discr ( bcx, & * repr, dest, disr) ;
2083
2083
}
2084
2084
2085
- finish_fn ( & fcx, bcx, result_ty) ;
2085
+ finish_fn ( & fcx, bcx, result_ty, DebugLoc :: None ) ;
2086
2086
}
2087
2087
2088
2088
fn enum_variant_size_lint ( ccx : & CrateContext , enum_def : & ast:: EnumDef , sp : Span , id : ast:: NodeId ) {
0 commit comments