diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2018-12-02 18:25:42 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2019-03-29 17:17:12 +0100 |
| commit | 794ecd965ab39d767caebd79c0e32702e86a3ff1 (patch) | |
| tree | a840973f0d0a133221c926a592f51a6b18a2a078 /src/librustc_codegen_ssa | |
| parent | ab8f1527e485d0de49139ca7b9d42c320991a53b (diff) | |
| download | rust-794ecd965ab39d767caebd79c0e32702e86a3ff1.tar.gz rust-794ecd965ab39d767caebd79c0e32702e86a3ff1.zip | |
[WIP] Make some debug info methods take &mut FunctionDebugContext
declare_local still takes &FunctionDebugContext, because of borrowck errors
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/mir/mod.rs | 14 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/debuginfo.rs | 4 |
2 files changed, 7 insertions, 11 deletions
diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 15597542d49..4d9579504c8 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -104,7 +104,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { source_info: mir::SourceInfo ) { let (scope, span) = self.debug_loc(source_info); - bx.set_source_location(&self.debug_context, scope, span); + bx.set_source_location(&mut self.debug_context, scope, span); } pub fn debug_loc(&self, source_info: mir::SourceInfo) -> (Option<Bx::DIScope>, Span) { @@ -203,7 +203,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( let fn_ty = cx.new_fn_type(sig, &[]); debug!("fn_ty: {:?}", fn_ty); - let debug_context = + let mut debug_context = cx.create_function_debug_context(instance, sig, llfn, mir); let mut bx = Bx::new_block(cx, llfn, "start"); @@ -225,7 +225,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( }).collect(); // Compute debuginfo scopes from MIR scopes. - let scopes = cx.create_mir_scopes(mir, &debug_context); + let scopes = cx.create_mir_scopes(mir, &mut debug_context); let (landing_pads, funclets) = create_funclets(mir, &mut bx, &cleanup_kinds, &block_bxs); let mut fx = FunctionCx { @@ -253,7 +253,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( // FIXME(dlrobertson): This is ugly. Find a better way of getting the `PlaceRef` or // `LocalRef` from `arg_local_refs` let mut va_list_ref = None; - let args = arg_local_refs(&mut bx, &fx, &fx.scopes, &memory_locals, &mut va_list_ref); + let args = arg_local_refs(&mut bx, &fx, &memory_locals, &mut va_list_ref); fx.va_list_ref = va_list_ref; let mut allocate_local = |local| { @@ -430,10 +430,6 @@ fn create_funclets<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( bx: &mut Bx, fx: &FunctionCx<'a, 'tcx, Bx>, - scopes: &IndexVec< - mir::SourceScope, - debuginfo::MirDebugScope<Bx::DIScope> - >, memory_locals: &BitSet<mir::Local>, va_list_ref: &mut Option<PlaceRef<'tcx, Bx::Value>>, ) -> Vec<LocalRef<'tcx, Bx::Value>> { @@ -443,7 +439,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( let mut llarg_idx = fx.fn_ty.ret.is_indirect() as usize; // Get the argument scope, if it exists and if we need it. - let arg_scope = scopes[mir::OUTERMOST_SOURCE_SCOPE]; + let arg_scope = fx.scopes[mir::OUTERMOST_SOURCE_SCOPE]; let arg_scope = if bx.sess().opts.debuginfo == DebugInfo::Full { arg_scope.scope_metadata } else { diff --git a/src/librustc_codegen_ssa/traits/debuginfo.rs b/src/librustc_codegen_ssa/traits/debuginfo.rs index 135188e98c7..dcbb4e66cb3 100644 --- a/src/librustc_codegen_ssa/traits/debuginfo.rs +++ b/src/librustc_codegen_ssa/traits/debuginfo.rs @@ -28,7 +28,7 @@ pub trait DebugInfoMethods<'tcx>: BackendTypes { fn create_mir_scopes( &self, mir: &mir::Mir<'_>, - debug_context: &FunctionDebugContext<Self::DIScope>, + debug_context: &mut FunctionDebugContext<Self::DIScope>, ) -> IndexVec<mir::SourceScope, MirDebugScope<Self::DIScope>>; fn extend_scope_to_file( &self, @@ -53,7 +53,7 @@ pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes { ); fn set_source_location( &mut self, - debug_context: &FunctionDebugContext<Self::DIScope>, + debug_context: &mut FunctionDebugContext<Self::DIScope>, scope: Option<Self::DIScope>, span: Span, ); |
