@@ -66,7 +66,7 @@ use trans::consts;
6666use trans:: context:: SharedCrateContext ;
6767use trans:: controlflow;
6868use trans:: datum;
69- use trans:: debuginfo:: { self , DebugLoc } ;
69+ use trans:: debuginfo:: { self , DebugLoc , ToDebugLoc } ;
7070use trans:: expr;
7171use trans:: foreign;
7272use trans:: glue;
@@ -540,9 +540,10 @@ pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
540540 lhs : ValueRef ,
541541 rhs : ValueRef ,
542542 t : Ty < ' tcx > ,
543- op : ast:: BinOp_ )
543+ op : ast:: BinOp_ ,
544+ debug_loc : DebugLoc )
544545 -> 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 ) ) ;
546547
547548 match t. sty {
548549 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>,
561562 lhs : ValueRef ,
562563 rhs : ValueRef ,
563564 nt : scalar_type ,
564- op : ast:: BinOp_ )
565+ op : ast:: BinOp_ ,
566+ debug_loc : DebugLoc )
565567 -> ValueRef {
566568 let _icx = push_ctxt ( "compare_scalar_values" ) ;
567569 fn die ( cx : Block ) -> ! {
@@ -588,7 +590,7 @@ pub fn compare_scalar_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
588590 ast:: BiGe => llvm:: RealOGE ,
589591 _ => die ( cx)
590592 } ;
591- return FCmp ( cx, cmp, lhs, rhs) ;
593+ return FCmp ( cx, cmp, lhs, rhs, debug_loc ) ;
592594 }
593595 signed_int => {
594596 let cmp = match op {
@@ -600,7 +602,7 @@ pub fn compare_scalar_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
600602 ast:: BiGe => llvm:: IntSGE ,
601603 _ => die ( cx)
602604 } ;
603- return ICmp ( cx, cmp, lhs, rhs) ;
605+ return ICmp ( cx, cmp, lhs, rhs, debug_loc ) ;
604606 }
605607 unsigned_int => {
606608 let cmp = match op {
@@ -612,7 +614,7 @@ pub fn compare_scalar_values<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
612614 ast:: BiGe => llvm:: IntUGE ,
613615 _ => die ( cx)
614616 } ;
615- return ICmp ( cx, cmp, lhs, rhs) ;
617+ return ICmp ( cx, cmp, lhs, rhs, debug_loc ) ;
616618 }
617619 }
618620}
@@ -623,7 +625,8 @@ pub fn compare_simd_types<'blk, 'tcx>(
623625 rhs : ValueRef ,
624626 t : Ty < ' tcx > ,
625627 size : uint ,
626- op : ast:: BinOp )
628+ op : ast:: BinOp_ ,
629+ debug_loc : DebugLoc )
627630 -> ValueRef {
628631 let cmp = match t. sty {
629632 ty:: ty_float( _) => {
@@ -634,7 +637,7 @@ pub fn compare_simd_types<'blk, 'tcx>(
634637 cx. sess ( ) . bug ( "compare_simd_types: comparison operators \
635638 not supported for floating point SIMD types")
636639 } ,
637- ty:: ty_uint( _) => match op. node {
640+ ty:: ty_uint( _) => match op {
638641 ast:: BiEq => llvm:: IntEQ ,
639642 ast:: BiNe => llvm:: IntNE ,
640643 ast:: BiLt => llvm:: IntULT ,
@@ -643,7 +646,7 @@ pub fn compare_simd_types<'blk, 'tcx>(
643646 ast:: BiGe => llvm:: IntUGE ,
644647 _ => cx. sess ( ) . bug ( "compare_simd_types: must be a comparison operator" ) ,
645648 } ,
646- ty:: ty_int( _) => match op. node {
649+ ty:: ty_int( _) => match op {
647650 ast:: BiEq => llvm:: IntEQ ,
648651 ast:: BiNe => llvm:: IntNE ,
649652 ast:: BiLt => llvm:: IntSLT ,
@@ -659,7 +662,7 @@ pub fn compare_simd_types<'blk, 'tcx>(
659662 // to get the correctly sized type. This will compile to a single instruction
660663 // once the IR is converted to assembly if the SIMD instruction is supported
661664 // 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)
663666}
664667
665668// Iterates through the elements of a structural type.
@@ -866,14 +869,16 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
866869 ( "attempted remainder with a divisor of zero" ,
867870 "attempted remainder with overflow" )
868871 } ;
872+ let debug_loc = call_info. debug_loc ( ) ;
873+
869874 let ( is_zero, is_signed) = match rhs_t. sty {
870875 ty:: ty_int( t) => {
871876 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 )
873878 }
874879 ty:: ty_uint( t) => {
875880 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 )
877882 }
878883 _ => {
879884 cx. sess ( ) . bug ( & format ! ( "fail-if-zero on unexpected type: {}" ,
@@ -910,10 +915,10 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
910915 _ => unreachable ! ( ) ,
911916 } ;
912917 let minus_one = ICmp ( bcx, llvm:: IntEQ , rhs,
913- C_integral ( llty, -1 , false ) ) ;
918+ C_integral ( llty, -1 , false ) , debug_loc ) ;
914919 with_cond ( bcx, minus_one, |bcx| {
915920 let is_min = ICmp ( bcx, llvm:: IntEQ , lhs,
916- C_integral ( llty, min, true ) ) ;
921+ C_integral ( llty, min, true ) , debug_loc ) ;
917922 with_cond ( bcx, is_min, |bcx| {
918923 controlflow:: trans_fail ( bcx,
919924 call_info,
0 commit comments