Skip to content

Commit 6dc94f7

Browse files
committed
rollup merge of #21197: michaelwoerister/linestablesonly-forloop
Fixes #21067.
2 parents 09c0342 + 45c6423 commit 6dc94f7

File tree

5 files changed

+28
-32
lines changed

5 files changed

+28
-32
lines changed

src/librustc_trans/trans/_match.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -856,16 +856,9 @@ fn insert_lllocals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
856856
bcx.fcx.schedule_lifetime_end(cs, binding_info.llmatch);
857857
}
858858

859-
debug!("binding {} to {}",
860-
binding_info.id,
861-
bcx.val_to_string(llval));
859+
debug!("binding {} to {}", binding_info.id, bcx.val_to_string(llval));
862860
bcx.fcx.lllocals.borrow_mut().insert(binding_info.id, datum);
863-
864-
if bcx.sess().opts.debuginfo == FullDebugInfo {
865-
debuginfo::create_match_binding_metadata(bcx,
866-
ident,
867-
binding_info);
868-
}
861+
debuginfo::create_match_binding_metadata(bcx, ident, binding_info);
869862
}
870863
bcx
871864
}

src/librustc_trans/trans/base.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use middle::subst;
4444
use middle::weak_lang_items;
4545
use middle::subst::{Subst, Substs};
4646
use middle::ty::{self, Ty, UnboxedClosureTyper};
47-
use session::config::{self, NoDebugInfo, FullDebugInfo};
47+
use session::config::{self, NoDebugInfo};
4848
use session::Session;
4949
use trans::_match;
5050
use trans::adt;
@@ -1617,9 +1617,8 @@ fn create_datums_for_fn_args_under_call_abi<'blk, 'tcx>(
16171617
result
16181618
}
16191619

1620-
fn copy_args_to_allocas<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>,
1620+
fn copy_args_to_allocas<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
16211621
arg_scope: cleanup::CustomScopeIndex,
1622-
bcx: Block<'blk, 'tcx>,
16231622
args: &[ast::Arg],
16241623
arg_datums: Vec<RvalueDatum<'tcx>>)
16251624
-> Block<'blk, 'tcx> {
@@ -1640,10 +1639,7 @@ fn copy_args_to_allocas<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>,
16401639
// the event it's not truly needed.
16411640

16421641
bcx = _match::store_arg(bcx, &*args[i].pat, arg_datum, arg_scope_id);
1643-
1644-
if fcx.ccx.sess().opts.debuginfo == FullDebugInfo {
1645-
debuginfo::create_argument_metadata(bcx, &args[i]);
1646-
}
1642+
debuginfo::create_argument_metadata(bcx, &args[i]);
16471643
}
16481644

16491645
bcx
@@ -1693,9 +1689,7 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>(
16931689
tuple_element_datum,
16941690
arg_scope_id);
16951691

1696-
if bcx.fcx.ccx.sess().opts.debuginfo == FullDebugInfo {
1697-
debuginfo::create_argument_metadata(bcx, &args[j]);
1698-
}
1692+
debuginfo::create_argument_metadata(bcx, &args[j]);
16991693
}
17001694

17011695
bcx
@@ -1868,9 +1862,8 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
18681862

18691863
bcx = match closure_env.kind {
18701864
closure::NotClosure | closure::BoxedClosure(..) => {
1871-
copy_args_to_allocas(&fcx,
1865+
copy_args_to_allocas(bcx,
18721866
arg_scope,
1873-
bcx,
18741867
&decl.inputs[],
18751868
arg_datums)
18761869
}

src/librustc_trans/trans/controlflow.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use trans::type_::Type;
2828
use trans;
2929
use middle::ty;
3030
use middle::ty::MethodCall;
31-
use session::config::FullDebugInfo;
3231
use util::ppaux::Repr;
3332
use util::ppaux;
3433

@@ -66,10 +65,7 @@ pub fn trans_stmt<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
6665
match d.node {
6766
ast::DeclLocal(ref local) => {
6867
bcx = init_local(bcx, &**local);
69-
if cx.sess().opts.debuginfo == FullDebugInfo {
70-
trans::debuginfo::create_local_var_metadata(bcx,
71-
&**local);
72-
}
68+
debuginfo::create_local_var_metadata(bcx, &**local);
7369
}
7470
// Inner items are visited by `trans_item`/`trans_meth`.
7571
ast::DeclItem(_) => {},

src/librustc_trans/trans/debuginfo.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,9 @@ pub fn create_global_var_metadata(cx: &CrateContext,
854854
/// local in `bcx.fcx.lllocals`.
855855
/// Adds the created metadata nodes directly to the crate's IR.
856856
pub fn create_local_var_metadata(bcx: Block, local: &ast::Local) {
857-
if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
857+
if bcx.unreachable.get() ||
858+
fn_should_be_ignored(bcx.fcx) ||
859+
bcx.sess().opts.debuginfo != FullDebugInfo {
858860
return;
859861
}
860862

@@ -898,7 +900,9 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
898900
env_index: uint,
899901
captured_by_ref: bool,
900902
span: Span) {
901-
if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
903+
if bcx.unreachable.get() ||
904+
fn_should_be_ignored(bcx.fcx) ||
905+
bcx.sess().opts.debuginfo != FullDebugInfo {
902906
return;
903907
}
904908

@@ -981,7 +985,9 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
981985
pub fn create_match_binding_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
982986
variable_ident: ast::Ident,
983987
binding: BindingInfo<'tcx>) {
984-
if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
988+
if bcx.unreachable.get() ||
989+
fn_should_be_ignored(bcx.fcx) ||
990+
bcx.sess().opts.debuginfo != FullDebugInfo {
985991
return;
986992
}
987993

@@ -1021,7 +1027,9 @@ pub fn create_match_binding_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
10211027
/// argument in `bcx.fcx.lllocals`.
10221028
/// Adds the created metadata nodes directly to the crate's IR.
10231029
pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) {
1024-
if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
1030+
if bcx.unreachable.get() ||
1031+
fn_should_be_ignored(bcx.fcx) ||
1032+
bcx.sess().opts.debuginfo != FullDebugInfo {
10251033
return;
10261034
}
10271035

@@ -1075,7 +1083,9 @@ pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) {
10751083
/// loop variable in `bcx.fcx.lllocals`.
10761084
/// Adds the created metadata nodes directly to the crate's IR.
10771085
pub fn create_for_loop_var_metadata(bcx: Block, pat: &ast::Pat) {
1078-
if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) {
1086+
if bcx.unreachable.get() ||
1087+
fn_should_be_ignored(bcx.fcx) ||
1088+
bcx.sess().opts.debuginfo != FullDebugInfo {
10791089
return;
10801090
}
10811091

src/test/debuginfo/limited-debuginfo.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ fn zzz() {()}
4848
fn some_function(a: int, b: int) {
4949
let some_variable = Struct { a: 11, b: 22 };
5050
let some_other_variable = 23i;
51-
zzz(); // #break
51+
52+
for x in range(0, 1) {
53+
zzz(); // #break
54+
}
5255
}
5356

5457
fn some_other_function(a: int, b: int) -> bool { true }
58+

0 commit comments

Comments
 (0)