From e5493a5ea260a4f112a081c4bc488d85049ca36c Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Thu, 18 Aug 2022 15:19:29 +0000 Subject: [PATCH] Remove Instance param of DebugContext::define_function --- src/base.rs | 8 ++++---- src/debuginfo/mod.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/base.rs b/src/base.rs index fe04567af66..b35f02e2d2d 100644 --- a/src/base.rs +++ b/src/base.rs @@ -14,11 +14,11 @@ use crate::prelude::*; use crate::pretty_clif::CommentWriter; struct CodegenedFunction<'tcx> { - instance: Instance<'tcx>, symbol_name: SymbolName<'tcx>, func_id: FuncId, func: Function, clif_comments: CommentWriter, + function_span: Span, source_info_set: IndexSet, } @@ -108,8 +108,8 @@ fn codegen_fn<'tcx>( tcx.sess.time("codegen clif ir", || codegen_fn_body(&mut fx, start_block)); // Recover all necessary data from fx, before accessing func will prevent future access to it. - let instance = fx.instance; let clif_comments = fx.clif_comments; + let function_span = fx.mir.span; let source_info_set = fx.source_info_set; fx.constants_cx.finalize(fx.tcx, &mut *fx.module); @@ -128,7 +128,7 @@ fn codegen_fn<'tcx>( // Verify function verify_func(tcx, &clif_comments, &func); - CodegenedFunction { instance, symbol_name, func_id, func, clif_comments, source_info_set } + CodegenedFunction { symbol_name, func_id, func, clif_comments, function_span, source_info_set } } fn compile_fn<'tcx>( @@ -214,10 +214,10 @@ fn compile_fn<'tcx>( cx.profiler.verbose_generic_activity("generate debug info").run(|| { if let Some(debug_context) = debug_context { debug_context.define_function( - codegened_func.instance, codegened_func.func_id, codegened_func.symbol_name.name, context, + codegened_func.function_span, &codegened_func.source_info_set, ); } diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs index 7a330ff7d35..9a0787508b7 100644 --- a/src/debuginfo/mod.rs +++ b/src/debuginfo/mod.rs @@ -97,14 +97,13 @@ impl<'tcx> DebugContext<'tcx> { pub(crate) fn define_function( &mut self, - instance: Instance<'tcx>, func_id: FuncId, name: &str, context: &Context, + function_span: Span, source_info_set: &indexmap::IndexSet, ) { let symbol = func_id.as_u32() as usize; - let mir = self.tcx.instance_mir(instance.def); // FIXME: add to appropriate scope instead of root let scope = self.dwarf.unit.root(); @@ -116,7 +115,8 @@ impl<'tcx> DebugContext<'tcx> { entry.set(gimli::DW_AT_name, AttributeValue::StringRef(name_id)); entry.set(gimli::DW_AT_linkage_name, AttributeValue::StringRef(name_id)); - let end = self.create_debug_lines(symbol, entry_id, context, mir.span, source_info_set); + let end = + self.create_debug_lines(symbol, entry_id, context, function_span, source_info_set); self.unit_range_list.0.push(Range::StartLength { begin: Address::Symbol { symbol, addend: 0 },