diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index f182045efd2..77d2280bb6e 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -857,16 +857,9 @@ fn insert_lllocals<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, bcx.fcx.schedule_lifetime_end(cs, binding_info.llmatch); } - debug!("binding {} to {}", - binding_info.id, - bcx.val_to_string(llval)); + debug!("binding {} to {}", binding_info.id, bcx.val_to_string(llval)); bcx.fcx.lllocals.borrow_mut().insert(binding_info.id, datum); - - if bcx.sess().opts.debuginfo == FullDebugInfo { - debuginfo::create_match_binding_metadata(bcx, - ident, - binding_info); - } + debuginfo::create_match_binding_metadata(bcx, ident, binding_info); } bcx } diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 28558c5a204..a8fd9e571f9 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -44,7 +44,7 @@ use middle::subst; use middle::weak_lang_items; use middle::subst::{Subst, Substs}; use middle::ty::{self, Ty, UnboxedClosureTyper}; -use session::config::{self, NoDebugInfo, FullDebugInfo}; +use session::config::{self, NoDebugInfo}; use session::Session; use trans::_match; use trans::adt; @@ -1626,9 +1626,8 @@ fn create_datums_for_fn_args_under_call_abi<'blk, 'tcx>( result } -fn copy_args_to_allocas<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>, +fn copy_args_to_allocas<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, arg_scope: cleanup::CustomScopeIndex, - bcx: Block<'blk, 'tcx>, args: &[ast::Arg], arg_datums: Vec>) -> Block<'blk, 'tcx> { @@ -1649,10 +1648,7 @@ fn copy_args_to_allocas<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>, // the event it's not truly needed. bcx = _match::store_arg(bcx, &*args[i].pat, arg_datum, arg_scope_id); - - if fcx.ccx.sess().opts.debuginfo == FullDebugInfo { - debuginfo::create_argument_metadata(bcx, &args[i]); - } + debuginfo::create_argument_metadata(bcx, &args[i]); } bcx @@ -1702,9 +1698,7 @@ fn copy_unboxed_closure_args_to_allocas<'blk, 'tcx>( tuple_element_datum, arg_scope_id); - if bcx.fcx.ccx.sess().opts.debuginfo == FullDebugInfo { - debuginfo::create_argument_metadata(bcx, &args[j]); - } + debuginfo::create_argument_metadata(bcx, &args[j]); } bcx @@ -1877,9 +1871,8 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>, bcx = match closure_env.kind { closure::NotClosure | closure::BoxedClosure(..) => { - copy_args_to_allocas(&fcx, + copy_args_to_allocas(bcx, arg_scope, - bcx, &decl.inputs[], arg_datums) } diff --git a/src/librustc_trans/trans/controlflow.rs b/src/librustc_trans/trans/controlflow.rs index adf302501cd..5dc939dc202 100644 --- a/src/librustc_trans/trans/controlflow.rs +++ b/src/librustc_trans/trans/controlflow.rs @@ -28,7 +28,6 @@ use trans::type_::Type; use trans; use middle::ty; use middle::ty::MethodCall; -use session::config::FullDebugInfo; use util::ppaux::Repr; use util::ppaux; @@ -66,10 +65,7 @@ pub fn trans_stmt<'blk, 'tcx>(cx: Block<'blk, 'tcx>, match d.node { ast::DeclLocal(ref local) => { bcx = init_local(bcx, &**local); - if cx.sess().opts.debuginfo == FullDebugInfo { - trans::debuginfo::create_local_var_metadata(bcx, - &**local); - } + debuginfo::create_local_var_metadata(bcx, &**local); } // Inner items are visited by `trans_item`/`trans_meth`. ast::DeclItem(_) => {}, diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index 5bbd83344bf..bbead5f4153 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -878,7 +878,9 @@ pub fn create_global_var_metadata(cx: &CrateContext, /// local in `bcx.fcx.lllocals`. /// Adds the created metadata nodes directly to the crate's IR. pub fn create_local_var_metadata(bcx: Block, local: &ast::Local) { - if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) { + if bcx.unreachable.get() || + fn_should_be_ignored(bcx.fcx) || + bcx.sess().opts.debuginfo != FullDebugInfo { return; } @@ -922,7 +924,9 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, env_index: uint, captured_by_ref: bool, span: Span) { - if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) { + if bcx.unreachable.get() || + fn_should_be_ignored(bcx.fcx) || + bcx.sess().opts.debuginfo != FullDebugInfo { return; } @@ -1005,7 +1009,9 @@ pub fn create_captured_var_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn create_match_binding_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, variable_ident: ast::Ident, binding: BindingInfo<'tcx>) { - if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) { + if bcx.unreachable.get() || + fn_should_be_ignored(bcx.fcx) || + bcx.sess().opts.debuginfo != FullDebugInfo { return; } @@ -1045,7 +1051,9 @@ pub fn create_match_binding_metadata<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, /// argument in `bcx.fcx.lllocals`. /// Adds the created metadata nodes directly to the crate's IR. pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) { - if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) { + if bcx.unreachable.get() || + fn_should_be_ignored(bcx.fcx) || + bcx.sess().opts.debuginfo != FullDebugInfo { return; } @@ -1099,7 +1107,9 @@ pub fn create_argument_metadata(bcx: Block, arg: &ast::Arg) { /// loop variable in `bcx.fcx.lllocals`. /// Adds the created metadata nodes directly to the crate's IR. pub fn create_for_loop_var_metadata(bcx: Block, pat: &ast::Pat) { - if bcx.unreachable.get() || fn_should_be_ignored(bcx.fcx) { + if bcx.unreachable.get() || + fn_should_be_ignored(bcx.fcx) || + bcx.sess().opts.debuginfo != FullDebugInfo { return; } diff --git a/src/test/debuginfo/limited-debuginfo.rs b/src/test/debuginfo/limited-debuginfo.rs index 35889ff8133..00de4497ced 100644 --- a/src/test/debuginfo/limited-debuginfo.rs +++ b/src/test/debuginfo/limited-debuginfo.rs @@ -48,7 +48,11 @@ fn zzz() {()} fn some_function(a: int, b: int) { let some_variable = Struct { a: 11, b: 22 }; let some_other_variable = 23i; - zzz(); // #break + + for x in range(0, 1) { + zzz(); // #break + } } fn some_other_function(a: int, b: int) -> bool { true } +