rustc_codegen_ssa/traits/
debuginfo.rs1use std::ops::Range;
2
3use rustc_abi::Size;
4use rustc_middle::ty::{ExistentialTraitRef, Instance, Ty};
5use rustc_span::{BytePos, SourceFile, Span, Symbol};
6use rustc_target::callconv::FnAbi;
7
8use super::BackendTypes;
9use crate::mir::debuginfo::VariableKind;
10
11pub trait DebugInfoCodegenMethods<'tcx>: BackendTypes {
12 fn create_vtable_debuginfo(
13 &self,
14 ty: Ty<'tcx>,
15 trait_ref: Option<ExistentialTraitRef<'tcx>>,
16 vtable: Self::Value,
17 );
18}
19
20pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
21 fn dbg_scope_fn(
24 &mut self,
25 instance: Instance<'tcx>,
26 fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
27 maybe_definition_llfn: Option<Self::Function>,
28 ) -> Self::DIScope;
29
30 fn dbg_create_lexical_block(
31 &mut self,
32 pos: BytePos,
33 parent_scope: Self::DIScope,
34 ) -> Self::DIScope;
35
36 fn dbg_location_clone_with_discriminator(
37 &mut self,
38 loc: Self::DILocation,
39 discriminator: u32,
40 ) -> Option<Self::DILocation>;
41
42 fn dbg_loc(
43 &mut self,
44 scope: Self::DIScope,
45 inlined_at: Option<Self::DILocation>,
46 span: Span,
47 ) -> Self::DILocation;
48
49 fn extend_scope_to_file(
50 &mut self,
51 scope_metadata: Self::DIScope,
52 file: &SourceFile,
53 ) -> Self::DIScope;
54
55 fn create_dbg_var(
58 &mut self,
59 variable_name: Symbol,
60 variable_type: Ty<'tcx>,
61 scope_metadata: Self::DIScope,
62 variable_kind: VariableKind,
63 span: Span,
64 ) -> Self::DIVariable;
65
66 fn dbg_var_addr(
69 &mut self,
70 dbg_var: Self::DIVariable,
71 dbg_loc: Self::DILocation,
72 variable_alloca: Self::Value,
73 direct_offset: Size,
74 indirect_offsets: &[Size],
76 fragment: &Option<Range<Size>>,
79 );
80 fn dbg_var_value(
81 &mut self,
82 dbg_var: Self::DIVariable,
83 dbg_loc: Self::DILocation,
84 value: Self::Value,
85 direct_offset: Size,
86 indirect_offsets: &[Size],
88 fragment: &Option<Range<Size>>,
91 );
92 fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
93 fn clear_dbg_loc(&mut self);
94 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
95 fn set_var_name(&mut self, value: Self::Value, name: &str);
96
97 fn with_move_annotation<R>(
104 &mut self,
105 _instance: Instance<'tcx>,
106 f: impl FnOnce(&mut Self) -> R,
107 ) -> R {
108 f(self)
109 }
110}