diff options
| author | Michael Woerister <michaelwoerister@posteo.net> | 2016-10-13 14:55:31 -0400 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2016-10-18 22:51:03 +0000 |
| commit | 2d493421cacc42d04e7626259cc08a51ef6c24cb (patch) | |
| tree | 0a3f7ab1668706d533e6692e8ce853c2aec4609a | |
| parent | f6859b07967e51de2620566340cfa8c4b1a7c4ab (diff) | |
| download | rust-2d493421cacc42d04e7626259cc08a51ef6c24cb.tar.gz rust-2d493421cacc42d04e7626259cc08a51ef6c24cb.zip | |
debuginfo: Create debuginfo for re-aggregated spread_arg instead of for the individual pieces.
| -rw-r--r-- | src/librustc_trans/mir/mod.rs | 35 |
1 files changed, 13 insertions, 22 deletions
diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_trans/mir/mod.rs index 727b680541d..3b2059cd7ed 100644 --- a/src/librustc_trans/mir/mod.rs +++ b/src/librustc_trans/mir/mod.rs @@ -22,7 +22,6 @@ use machine; use type_of; use syntax_pos::DUMMY_SP; -use syntax::parse::token::keywords; use std::ops::Deref; use std::rc::Rc; @@ -301,7 +300,6 @@ fn arg_local_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>, _ => bug!("spread argument isn't a tuple?!") }; - let lltuplety = type_of::type_of(bcx.ccx(), arg_ty); let lltemp = bcx.with_block(|bcx| { base::alloc_ty(bcx, arg_ty, &format!("arg{}", arg_index)) }); @@ -319,27 +317,20 @@ fn arg_local_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>, } else { arg.store_fn_arg(bcx, &mut llarg_idx, dst); } - - bcx.with_block(|bcx| arg_scope.map(|scope| { - let byte_offset_of_var_in_tuple = - machine::llelement_offset(bcx.ccx(), lltuplety, i); - - let ops = unsafe { - [llvm::LLVMRustDIBuilderCreateOpDeref(), - llvm::LLVMRustDIBuilderCreateOpPlus(), - byte_offset_of_var_in_tuple as i64] - }; - - let variable_access = VariableAccess::IndirectVariable { - alloca: lltemp, - address_operations: &ops - }; - declare_local(bcx, keywords::Invalid.name(), - tupled_arg_ty, scope, variable_access, - VariableKind::ArgumentVariable(arg_index + i + 1), - bcx.fcx().span.unwrap_or(DUMMY_SP)); - })); } + + // Now that we have one alloca that contains the aggregate value, + // we can create one debuginfo entry for the argument. + bcx.with_block(|bcx| arg_scope.map(|scope| { + let variable_access = VariableAccess::DirectVariable { + alloca: lltemp + }; + declare_local(bcx, arg_decl.debug_name, + arg_ty, scope, variable_access, + VariableKind::ArgumentVariable(arg_index + 1), + bcx.fcx().span.unwrap_or(DUMMY_SP)); + })); + return LocalRef::Lvalue(LvalueRef::new_sized(lltemp, LvalueTy::from_ty(arg_ty))); } |
