@@ -14,6 +14,7 @@ use middle::trans::base::*;
14
14
use middle:: trans:: build:: * ;
15
15
use middle:: trans:: callee;
16
16
use middle:: trans:: common:: * ;
17
+ use middle:: trans:: debuginfo;
17
18
use middle:: trans:: expr;
18
19
use middle:: ty;
19
20
use util:: common:: indenter;
@@ -75,6 +76,7 @@ pub fn trans_if(bcx: @mut Block,
75
76
// if true { .. } [else { .. }]
76
77
return do with_scope ( bcx, thn. info ( ) , "if_true_then" ) |bcx| {
77
78
let bcx_out = trans_block ( bcx, thn, dest) ;
79
+ debuginfo:: clear_source_location ( bcx. fcx ) ;
78
80
trans_block_cleanups ( bcx_out, block_cleanups ( bcx) )
79
81
}
80
82
} else {
@@ -86,6 +88,7 @@ pub fn trans_if(bcx: @mut Block,
86
88
Some ( elexpr) => {
87
89
return do with_scope ( bcx, elexpr. info ( ) , "if_false_then" ) |bcx| {
88
90
let bcx_out = trans_if_else ( bcx, elexpr, dest) ;
91
+ debuginfo:: clear_source_location ( bcx. fcx ) ;
89
92
trans_block_cleanups ( bcx_out, block_cleanups ( bcx) )
90
93
}
91
94
}
@@ -98,6 +101,8 @@ pub fn trans_if(bcx: @mut Block,
98
101
let then_bcx_in = scope_block ( bcx, thn. info ( ) , "then" ) ;
99
102
100
103
let then_bcx_out = trans_block ( then_bcx_in, thn, dest) ;
104
+
105
+ debuginfo:: clear_source_location ( bcx. fcx ) ;
101
106
let then_bcx_out = trans_block_cleanups ( then_bcx_out,
102
107
block_cleanups ( then_bcx_in) ) ;
103
108
@@ -122,6 +127,9 @@ pub fn trans_if(bcx: @mut Block,
122
127
debug ! ( "then_bcx_in={}, else_bcx_in={}" ,
123
128
then_bcx_in. to_str( ) , else_bcx_in. to_str( ) ) ;
124
129
130
+ // Clear the source location because it is still set to whatever has been translated
131
+ // right before.
132
+ debuginfo:: clear_source_location ( else_bcx_in. fcx ) ;
125
133
CondBr ( bcx, cond_val, then_bcx_in. llbb , else_bcx_in. llbb ) ;
126
134
return next_bcx;
127
135
@@ -139,6 +147,7 @@ pub fn trans_if(bcx: @mut Block,
139
147
// would be nice to have a constraint on ifs
140
148
_ => else_bcx_in. tcx ( ) . sess . bug ( "strange alternative in if" )
141
149
} ;
150
+ debuginfo:: clear_source_location ( else_bcx_in. fcx ) ;
142
151
trans_block_cleanups ( else_bcx_out, block_cleanups ( else_bcx_in) )
143
152
}
144
153
}
0 commit comments