debuginfo: Fix ICE when compiling for-loops with lines-tables-only.

This commit is contained in:
Michael Woerister 2015-01-15 15:22:56 +01:00
parent 1c78ad937b
commit 45c6423cbc
5 changed files with 28 additions and 32 deletions

View File

@ -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
}

View File

@ -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<RvalueDatum<'tcx>>)
-> 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)
}

View File

@ -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(_) => {},

View File

@ -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;
}

View File

@ -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 }