Skip to content

Commit 0704414

Browse files
committed
---
yaml --- r: 93741 b: refs/heads/try c: 7fc3e82 h: refs/heads/master i: 93739: 198db84 v: v3
1 parent b2b72d1 commit 0704414

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 85f107d8cba0560e1edce8ad7158024f2489ca3b
5+
refs/heads/try: 7fc3e82aaeb15c067a1eed914032ba21a7763557
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustc/middle/trans/controlflow.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use middle::trans::base::*;
1414
use middle::trans::build::*;
1515
use middle::trans::callee;
1616
use middle::trans::common::*;
17+
use middle::trans::debuginfo;
1718
use middle::trans::expr;
1819
use middle::ty;
1920
use util::common::indenter;
@@ -75,6 +76,7 @@ pub fn trans_if(bcx: @mut Block,
7576
// if true { .. } [else { .. }]
7677
return do with_scope(bcx, thn.info(), "if_true_then") |bcx| {
7778
let bcx_out = trans_block(bcx, thn, dest);
79+
debuginfo::clear_source_location(bcx.fcx);
7880
trans_block_cleanups(bcx_out, block_cleanups(bcx))
7981
}
8082
} else {
@@ -86,6 +88,7 @@ pub fn trans_if(bcx: @mut Block,
8688
Some(elexpr) => {
8789
return do with_scope(bcx, elexpr.info(), "if_false_then") |bcx| {
8890
let bcx_out = trans_if_else(bcx, elexpr, dest);
91+
debuginfo::clear_source_location(bcx.fcx);
8992
trans_block_cleanups(bcx_out, block_cleanups(bcx))
9093
}
9194
}
@@ -98,6 +101,8 @@ pub fn trans_if(bcx: @mut Block,
98101
let then_bcx_in = scope_block(bcx, thn.info(), "then");
99102

100103
let then_bcx_out = trans_block(then_bcx_in, thn, dest);
104+
105+
debuginfo::clear_source_location(bcx.fcx);
101106
let then_bcx_out = trans_block_cleanups(then_bcx_out,
102107
block_cleanups(then_bcx_in));
103108

@@ -122,6 +127,9 @@ pub fn trans_if(bcx: @mut Block,
122127
debug!("then_bcx_in={}, else_bcx_in={}",
123128
then_bcx_in.to_str(), else_bcx_in.to_str());
124129

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);
125133
CondBr(bcx, cond_val, then_bcx_in.llbb, else_bcx_in.llbb);
126134
return next_bcx;
127135

@@ -139,6 +147,7 @@ pub fn trans_if(bcx: @mut Block,
139147
// would be nice to have a constraint on ifs
140148
_ => else_bcx_in.tcx().sess.bug("strange alternative in if")
141149
};
150+
debuginfo::clear_source_location(else_bcx_in.fcx);
142151
trans_block_cleanups(else_bcx_out, block_cleanups(else_bcx_in))
143152
}
144153
}

branches/try/src/librustc/middle/trans/debuginfo.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@ pub fn set_source_location(fcx: &FunctionContext,
509509
}
510510
}
511511

512+
/// Clears the current debug location.
513+
///
514+
/// Instructions generated hereafter won't be assigned a source location.
515+
pub fn clear_source_location(fcx: &FunctionContext) {
516+
if fn_should_be_ignored(fcx) {
517+
return;
518+
}
519+
520+
set_debug_location(fcx.ccx, UnknownLocation);
521+
}
522+
512523
/// Enables emitting source locations for the given functions.
513524
///
514525
/// Since we don't want source locations to be emitted for the function prelude, they are disabled

0 commit comments

Comments
 (0)