Skip to content

Commit e5493a5

Browse files
committed
Remove Instance param of DebugContext::define_function
1 parent a49416d commit e5493a5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/base.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ use crate::prelude::*;
1414
use crate::pretty_clif::CommentWriter;
1515

1616
struct CodegenedFunction<'tcx> {
17-
instance: Instance<'tcx>,
1817
symbol_name: SymbolName<'tcx>,
1918
func_id: FuncId,
2019
func: Function,
2120
clif_comments: CommentWriter,
21+
function_span: Span,
2222
source_info_set: IndexSet<SourceInfo>,
2323
}
2424

@@ -108,8 +108,8 @@ fn codegen_fn<'tcx>(
108108
tcx.sess.time("codegen clif ir", || codegen_fn_body(&mut fx, start_block));
109109

110110
// Recover all necessary data from fx, before accessing func will prevent future access to it.
111-
let instance = fx.instance;
112111
let clif_comments = fx.clif_comments;
112+
let function_span = fx.mir.span;
113113
let source_info_set = fx.source_info_set;
114114

115115
fx.constants_cx.finalize(fx.tcx, &mut *fx.module);
@@ -128,7 +128,7 @@ fn codegen_fn<'tcx>(
128128
// Verify function
129129
verify_func(tcx, &clif_comments, &func);
130130

131-
CodegenedFunction { instance, symbol_name, func_id, func, clif_comments, source_info_set }
131+
CodegenedFunction { symbol_name, func_id, func, clif_comments, function_span, source_info_set }
132132
}
133133

134134
fn compile_fn<'tcx>(
@@ -214,10 +214,10 @@ fn compile_fn<'tcx>(
214214
cx.profiler.verbose_generic_activity("generate debug info").run(|| {
215215
if let Some(debug_context) = debug_context {
216216
debug_context.define_function(
217-
codegened_func.instance,
218217
codegened_func.func_id,
219218
codegened_func.symbol_name.name,
220219
context,
220+
codegened_func.function_span,
221221
&codegened_func.source_info_set,
222222
);
223223
}

src/debuginfo/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,13 @@ impl<'tcx> DebugContext<'tcx> {
9797

9898
pub(crate) fn define_function(
9999
&mut self,
100-
instance: Instance<'tcx>,
101100
func_id: FuncId,
102101
name: &str,
103102
context: &Context,
103+
function_span: Span,
104104
source_info_set: &indexmap::IndexSet<SourceInfo>,
105105
) {
106106
let symbol = func_id.as_u32() as usize;
107-
let mir = self.tcx.instance_mir(instance.def);
108107

109108
// FIXME: add to appropriate scope instead of root
110109
let scope = self.dwarf.unit.root();
@@ -116,7 +115,8 @@ impl<'tcx> DebugContext<'tcx> {
116115
entry.set(gimli::DW_AT_name, AttributeValue::StringRef(name_id));
117116
entry.set(gimli::DW_AT_linkage_name, AttributeValue::StringRef(name_id));
118117

119-
let end = self.create_debug_lines(symbol, entry_id, context, mir.span, source_info_set);
118+
let end =
119+
self.create_debug_lines(symbol, entry_id, context, function_span, source_info_set);
120120

121121
self.unit_range_list.0.push(Range::StartLength {
122122
begin: Address::Symbol { symbol, addend: 0 },

0 commit comments

Comments
 (0)