@@ -21,7 +21,6 @@ use machine;
2121use type_of;
2222
2323use syntax_pos:: { DUMMY_SP , NO_EXPANSION , COMMAND_LINE_EXPN , BytePos } ;
24- use syntax:: parse:: token:: keywords;
2524
2625use std:: ops:: Deref ;
2726use std:: rc:: Rc ;
@@ -360,7 +359,6 @@ fn arg_local_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>,
360359 _ => bug ! ( "spread argument isn't a tuple?!" )
361360 } ;
362361
363- let lltuplety = type_of:: type_of ( bcx. ccx ( ) , arg_ty) ;
364362 let lltemp = bcx. with_block ( |bcx| {
365363 base:: alloc_ty ( bcx, arg_ty, & format ! ( "arg{}" , arg_index) )
366364 } ) ;
@@ -378,27 +376,20 @@ fn arg_local_refs<'bcx, 'tcx>(bcx: &BlockAndBuilder<'bcx, 'tcx>,
378376 } else {
379377 arg. store_fn_arg ( bcx, & mut llarg_idx, dst) ;
380378 }
381-
382- bcx. with_block ( |bcx| arg_scope. map ( |scope| {
383- let byte_offset_of_var_in_tuple =
384- machine:: llelement_offset ( bcx. ccx ( ) , lltuplety, i) ;
385-
386- let ops = unsafe {
387- [ llvm:: LLVMRustDIBuilderCreateOpDeref ( ) ,
388- llvm:: LLVMRustDIBuilderCreateOpPlus ( ) ,
389- byte_offset_of_var_in_tuple as i64 ]
390- } ;
391-
392- let variable_access = VariableAccess :: IndirectVariable {
393- alloca : lltemp,
394- address_operations : & ops
395- } ;
396- declare_local ( bcx, keywords:: Invalid . name ( ) ,
397- tupled_arg_ty, scope, variable_access,
398- VariableKind :: ArgumentVariable ( arg_index + i + 1 ) ,
399- bcx. fcx ( ) . span . unwrap_or ( DUMMY_SP ) ) ;
400- } ) ) ;
401379 }
380+
381+ // Now that we have one alloca that contains the aggregate value,
382+ // we can create one debuginfo entry for the argument.
383+ bcx. with_block ( |bcx| arg_scope. map ( |scope| {
384+ let variable_access = VariableAccess :: DirectVariable {
385+ alloca : lltemp
386+ } ;
387+ declare_local ( bcx, arg_decl. debug_name ,
388+ arg_ty, scope, variable_access,
389+ VariableKind :: ArgumentVariable ( arg_index + 1 ) ,
390+ bcx. fcx ( ) . span . unwrap_or ( DUMMY_SP ) ) ;
391+ } ) ) ;
392+
402393 return LocalRef :: Lvalue ( LvalueRef :: new_sized ( lltemp, LvalueTy :: from_ty ( arg_ty) ) ) ;
403394 }
404395
0 commit comments