about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-08-18 15:19:29 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-08-18 15:25:47 +0000
commite5493a5ea260a4f112a081c4bc488d85049ca36c (patch)
tree683dff1da11967a1e21b98f49609631680881e5e
parenta49416da6ddcbcbd40f7aadb06b71d77c23e8220 (diff)
downloadrust-e5493a5ea260a4f112a081c4bc488d85049ca36c.tar.gz
rust-e5493a5ea260a4f112a081c4bc488d85049ca36c.zip
Remove Instance param of DebugContext::define_function
-rw-r--r--src/base.rs8
-rw-r--r--src/debuginfo/mod.rs6
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<SourceInfo>,
 }
 
@@ -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<SourceInfo>,
     ) {
         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 },