@@ -30,6 +30,7 @@ use crate::abi::FnAbiLlvmExt;
30
30
use crate :: attributes;
31
31
use crate :: common:: Funclet ;
32
32
use crate :: context:: CodegenCx ;
33
+ use crate :: llvm:: debuginfo:: DILocation ;
33
34
use crate :: llvm:: { self , AtomicOrdering , AtomicRmwBinOp , BasicBlock , False , True } ;
34
35
use crate :: type_:: Type ;
35
36
use crate :: type_of:: LayoutLlvmExt ;
@@ -234,6 +235,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
234
235
catch : & ' ll BasicBlock ,
235
236
funclet : Option < & Funclet < ' ll > > ,
236
237
instance : Option < Instance < ' tcx > > ,
238
+ dbg_loc : Option < & ' ll DILocation > ,
237
239
) -> & ' ll Value {
238
240
debug ! ( "invoke {:?} with args ({:?})" , llfn, args) ;
239
241
@@ -245,7 +247,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
245
247
}
246
248
247
249
// Emit CFI pointer type membership test
248
- self . cfi_type_test ( fn_attrs, fn_abi, instance, llfn) ;
250
+ self . cfi_type_test ( fn_attrs, fn_abi, instance, dbg_loc , llfn) ;
249
251
250
252
// Emit KCFI operand bundle
251
253
let kcfi_bundle = self . kcfi_operand_bundle ( fn_attrs, fn_abi, instance, llfn) ;
@@ -1172,6 +1174,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
1172
1174
args : & [ & ' ll Value ] ,
1173
1175
funclet : Option < & Funclet < ' ll > > ,
1174
1176
instance : Option < Instance < ' tcx > > ,
1177
+ dbg_loc : Option < & ' ll DILocation > ,
1175
1178
) -> & ' ll Value {
1176
1179
debug ! ( "call {:?} with args ({:?})" , llfn, args) ;
1177
1180
@@ -1183,7 +1186,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
1183
1186
}
1184
1187
1185
1188
// Emit CFI pointer type membership test
1186
- self . cfi_type_test ( fn_attrs, fn_abi, instance, llfn) ;
1189
+ self . cfi_type_test ( fn_attrs, fn_abi, instance, dbg_loc , llfn) ;
1187
1190
1188
1191
// Emit KCFI operand bundle
1189
1192
let kcfi_bundle = self . kcfi_operand_bundle ( fn_attrs, fn_abi, instance, llfn) ;
@@ -1414,7 +1417,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1414
1417
1415
1418
pub ( crate ) fn call_intrinsic ( & mut self , intrinsic : & str , args : & [ & ' ll Value ] ) -> & ' ll Value {
1416
1419
let ( ty, f) = self . cx . get_intrinsic ( intrinsic) ;
1417
- self . call ( ty, None , None , f, args, None , None )
1420
+ self . call ( ty, None , None , f, args, None , None , None )
1418
1421
}
1419
1422
1420
1423
fn call_lifetime_intrinsic ( & mut self , intrinsic : & str , ptr : & ' ll Value , size : Size ) {
@@ -1472,7 +1475,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1472
1475
format ! ( "llvm.{instr}.sat.i{int_width}.f{float_width}" )
1473
1476
} ;
1474
1477
let f = self . declare_cfn ( & name, llvm:: UnnamedAddr :: No , self . type_func ( & [ src_ty] , dest_ty) ) ;
1475
- self . call ( self . type_func ( & [ src_ty] , dest_ty) , None , None , f, & [ val] , None , None )
1478
+ self . call ( self . type_func ( & [ src_ty] , dest_ty) , None , None , f, & [ val] , None , None , None )
1476
1479
}
1477
1480
1478
1481
pub ( crate ) fn landing_pad (
@@ -1501,6 +1504,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1501
1504
indirect_dest : & [ & ' ll BasicBlock ] ,
1502
1505
funclet : Option < & Funclet < ' ll > > ,
1503
1506
instance : Option < Instance < ' tcx > > ,
1507
+ dbg_loc : Option < & ' ll DILocation > ,
1504
1508
) -> & ' ll Value {
1505
1509
debug ! ( "invoke {:?} with args ({:?})" , llfn, args) ;
1506
1510
@@ -1512,7 +1516,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1512
1516
}
1513
1517
1514
1518
// Emit CFI pointer type membership test
1515
- self . cfi_type_test ( fn_attrs, fn_abi, instance, llfn) ;
1519
+ self . cfi_type_test ( fn_attrs, fn_abi, instance, dbg_loc , llfn) ;
1516
1520
1517
1521
// Emit KCFI operand bundle
1518
1522
let kcfi_bundle = self . kcfi_operand_bundle ( fn_attrs, fn_abi, instance, llfn) ;
@@ -1547,6 +1551,7 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1547
1551
fn_attrs : Option < & CodegenFnAttrs > ,
1548
1552
fn_abi : Option < & FnAbi < ' tcx , Ty < ' tcx > > > ,
1549
1553
instance : Option < Instance < ' tcx > > ,
1554
+ dbg_loc : Option < & ' ll DILocation > ,
1550
1555
llfn : & ' ll Value ,
1551
1556
) {
1552
1557
let is_indirect_call = unsafe { llvm:: LLVMRustIsNonGVFunctionPointerTy ( llfn) } ;
@@ -1582,10 +1587,16 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1582
1587
self . cond_br ( cond, bb_pass, bb_fail) ;
1583
1588
1584
1589
self . switch_to_block ( bb_fail) ;
1590
+ if let Some ( dbg_loc) = dbg_loc {
1591
+ self . set_dbg_loc ( dbg_loc) ;
1592
+ }
1585
1593
self . abort ( ) ;
1586
1594
self . unreachable ( ) ;
1587
1595
1588
1596
self . switch_to_block ( bb_pass) ;
1597
+ if let Some ( dbg_loc) = dbg_loc {
1598
+ self . set_dbg_loc ( dbg_loc) ;
1599
+ }
1589
1600
}
1590
1601
}
1591
1602
0 commit comments