@@ -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:: { self , DebugLoc } ;
69
+ use trans:: debuginfo:: { self , DebugLoc , ToDebugLoc } ;
70
70
use trans:: expr;
71
71
use trans:: foreign;
72
72
use trans:: glue;
@@ -540,9 +540,10 @@ pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
540
540
lhs : ValueRef ,
541
541
rhs : ValueRef ,
542
542
t : Ty < ' tcx > ,
543
- op : ast:: BinOp_ )
543
+ op : ast:: BinOp_ ,
544
+ debug_loc : DebugLoc )
544
545
-> Result < ' blk , ' tcx > {
545
- let f = |a| Result :: new ( cx, compare_scalar_values ( cx, lhs, rhs, a, op) ) ;
546
+ let f = |a| Result :: new ( cx, compare_scalar_values ( cx, lhs, rhs, a, op, debug_loc ) ) ;
546
547
547
548
match t. sty {
548
549
ty:: ty_tup( ref tys) if tys. is_empty ( ) => f ( nil_type) ,
@@ -561,7 +562,8 @@ pub fn compare_scalar_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
561
562
lhs : ValueRef ,
562
563
rhs : ValueRef ,
563
564
nt : scalar_type ,
564
- op : ast:: BinOp_ )
565
+ op : ast:: BinOp_ ,
566
+ debug_loc : DebugLoc )
565
567
-> ValueRef {
566
568
let _icx = push_ctxt ( "compare_scalar_values" ) ;
567
569
fn die ( cx : Block ) -> ! {
@@ -588,7 +590,7 @@ pub fn compare_scalar_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
588
590
ast:: BiGe => llvm:: RealOGE ,
589
591
_ => die ( cx)
590
592
} ;
591
- return FCmp ( cx, cmp, lhs, rhs) ;
593
+ return FCmp ( cx, cmp, lhs, rhs, debug_loc ) ;
592
594
}
593
595
signed_int => {
594
596
let cmp = match op {
@@ -600,7 +602,7 @@ pub fn compare_scalar_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
600
602
ast:: BiGe => llvm:: IntSGE ,
601
603
_ => die ( cx)
602
604
} ;
603
- return ICmp ( cx, cmp, lhs, rhs) ;
605
+ return ICmp ( cx, cmp, lhs, rhs, debug_loc ) ;
604
606
}
605
607
unsigned_int => {
606
608
let cmp = match op {
@@ -612,7 +614,7 @@ pub fn compare_scalar_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
612
614
ast:: BiGe => llvm:: IntUGE ,
613
615
_ => die ( cx)
614
616
} ;
615
- return ICmp ( cx, cmp, lhs, rhs) ;
617
+ return ICmp ( cx, cmp, lhs, rhs, debug_loc ) ;
616
618
}
617
619
}
618
620
}
@@ -623,7 +625,8 @@ pub fn compare_simd_types<'blk, 'tcx>(
623
625
rhs : ValueRef ,
624
626
t : Ty < ' tcx > ,
625
627
size : uint ,
626
- op : ast:: BinOp )
628
+ op : ast:: BinOp_ ,
629
+ debug_loc : DebugLoc )
627
630
-> ValueRef {
628
631
let cmp = match t. sty {
629
632
ty:: ty_float( _) => {
@@ -634,7 +637,7 @@ pub fn compare_simd_types<'blk, 'tcx>(
634
637
cx. sess ( ) . bug ( "compare_simd_types: comparison operators \
635
638
not supported for floating point SIMD types")
636
639
} ,
637
- ty:: ty_uint( _) => match op. node {
640
+ ty:: ty_uint( _) => match op {
638
641
ast:: BiEq => llvm:: IntEQ ,
639
642
ast:: BiNe => llvm:: IntNE ,
640
643
ast:: BiLt => llvm:: IntULT ,
@@ -643,7 +646,7 @@ pub fn compare_simd_types<'blk, 'tcx>(
643
646
ast:: BiGe => llvm:: IntUGE ,
644
647
_ => cx. sess ( ) . bug ( "compare_simd_types: must be a comparison operator" ) ,
645
648
} ,
646
- ty:: ty_int( _) => match op. node {
649
+ ty:: ty_int( _) => match op {
647
650
ast:: BiEq => llvm:: IntEQ ,
648
651
ast:: BiNe => llvm:: IntNE ,
649
652
ast:: BiLt => llvm:: IntSLT ,
@@ -659,7 +662,7 @@ pub fn compare_simd_types<'blk, 'tcx>(
659
662
// to get the correctly sized type. This will compile to a single instruction
660
663
// once the IR is converted to assembly if the SIMD instruction is supported
661
664
// by the target architecture.
662
- SExt ( cx, ICmp ( cx, cmp, lhs, rhs) , return_ty)
665
+ SExt ( cx, ICmp ( cx, cmp, lhs, rhs, debug_loc ) , return_ty)
663
666
}
664
667
665
668
// Iterates through the elements of a structural type.
@@ -866,14 +869,16 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
866
869
( "attempted remainder with a divisor of zero" ,
867
870
"attempted remainder with overflow" )
868
871
} ;
872
+ let debug_loc = call_info. debug_loc ( ) ;
873
+
869
874
let ( is_zero, is_signed) = match rhs_t. sty {
870
875
ty:: ty_int( t) => {
871
876
let zero = C_integral ( Type :: int_from_ty ( cx. ccx ( ) , t) , 0u64 , false ) ;
872
- ( ICmp ( cx, llvm:: IntEQ , rhs, zero) , true )
877
+ ( ICmp ( cx, llvm:: IntEQ , rhs, zero, debug_loc ) , true )
873
878
}
874
879
ty:: ty_uint( t) => {
875
880
let zero = C_integral ( Type :: uint_from_ty ( cx. ccx ( ) , t) , 0u64 , false ) ;
876
- ( ICmp ( cx, llvm:: IntEQ , rhs, zero) , false )
881
+ ( ICmp ( cx, llvm:: IntEQ , rhs, zero, debug_loc ) , false )
877
882
}
878
883
_ => {
879
884
cx. sess ( ) . bug ( & format ! ( "fail-if-zero on unexpected type: {}" ,
@@ -910,10 +915,10 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
910
915
_ => unreachable ! ( ) ,
911
916
} ;
912
917
let minus_one = ICmp ( bcx, llvm:: IntEQ , rhs,
913
- C_integral ( llty, -1 , false ) ) ;
918
+ C_integral ( llty, -1 , false ) , debug_loc ) ;
914
919
with_cond ( bcx, minus_one, |bcx| {
915
920
let is_min = ICmp ( bcx, llvm:: IntEQ , lhs,
916
- C_integral ( llty, min, true ) ) ;
921
+ C_integral ( llty, min, true ) , debug_loc ) ;
917
922
with_cond ( bcx, is_min, |bcx| {
918
923
controlflow:: trans_fail ( bcx,
919
924
call_info,
0 commit comments