2 use rustc_codegen_ssa::mir::debuginfo::{FunctionDebugContext, VariableKind};
3 use rustc_codegen_ssa::traits::{DebugInfoBuilderMethods, DebugInfoMethods};
5 use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
6 use rustc_span::{SourceFile, Span, Symbol};
7 use rustc_target::abi::call::FnAbi;
8 use rustc_target::abi::Size;
11 use crate::builder::Builder;
12 use crate::context::CodegenCx;
14 impl<'a, 'gcc, 'tcx> DebugInfoBuilderMethods for Builder<'a, 'gcc, 'tcx> {
15 // FIXME(eddyb) find a common convention for all of the debuginfo-related
16 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
19 _dbg_var: Self::DIVariable,
20 _scope_metadata: Self::DIScope,
21 _variable_alloca: Self::Value,
23 _indirect_offsets: &[Size],
24 _fragment: Option<Range<Size>>,
29 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) {
30 // TODO(antoyo): insert reference to gdb debug scripts section global.
33 fn set_var_name(&mut self, _value: RValue<'gcc>, _name: &str) {
37 fn set_dbg_loc(&mut self, _dbg_loc: Self::DILocation) {
42 impl<'gcc, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
43 fn create_vtable_debuginfo(
46 _trait_ref: Option<PolyExistentialTraitRef<'tcx>>,
52 fn create_function_debug_context(
54 _instance: Instance<'tcx>,
55 _fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
57 _mir: &mir::Body<'tcx>,
58 ) -> Option<FunctionDebugContext<Self::DIScope, Self::DILocation>> {
63 fn extend_scope_to_file(
65 _scope_metadata: Self::DIScope,
71 fn debuginfo_finalize(&self) {
77 _variable_name: Symbol,
78 _variable_type: Ty<'tcx>,
79 _scope_metadata: Self::DIScope,
80 _variable_kind: VariableKind,
82 ) -> Self::DIVariable {
88 _instance: Instance<'tcx>,
89 _fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
90 _maybe_definition_llfn: Option<RValue<'gcc>>,
97 _scope: Self::DIScope,
98 _inlined_at: Option<Self::DILocation>,
100 ) -> Self::DILocation {