]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_codegen_ssa/src/traits/debuginfo.rs
New upstream version 1.49.0~beta.4+dfsg1
[rustc.git] / compiler / rustc_codegen_ssa / src / traits / debuginfo.rs
CommitLineData
a1dfa0c6 1use super::BackendTypes;
e74abb32 2use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
ba9703b0
XL
3use rustc_middle::mir;
4use rustc_middle::ty::{Instance, Ty};
f9f354fc 5use rustc_span::{SourceFile, Span, Symbol};
60c5eb7d 6use rustc_target::abi::call::FnAbi;
ba9703b0 7use rustc_target::abi::Size;
a1dfa0c6
XL
8
9pub trait DebugInfoMethods<'tcx>: BackendTypes {
10 fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
11
12 /// Creates the function-specific debug context.
13 ///
14 /// Returns the FunctionDebugContext for the function which holds state needed
e74abb32 15 /// for debug info creation, if it is enabled.
a1dfa0c6
XL
16 fn create_function_debug_context(
17 &self,
18 instance: Instance<'tcx>,
60c5eb7d 19 fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
e74abb32 20 llfn: Self::Function,
29967ef6
XL
21 mir: &mir::Body<'tcx>,
22 ) -> Option<FunctionDebugContext<Self::DIScope, Self::DILocation>>;
23
24 // FIXME(eddyb) find a common convention for all of the debuginfo-related
25 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
26 fn dbg_scope_fn(
27 &self,
28 instance: Instance<'tcx>,
29 fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
30 maybe_definition_llfn: Option<Self::Function>,
31 ) -> Self::DIScope;
32
33 fn dbg_loc(
34 &self,
35 scope: Self::DIScope,
36 inlined_at: Option<Self::DILocation>,
37 span: Span,
38 ) -> Self::DILocation;
a1dfa0c6 39
a1dfa0c6
XL
40 fn extend_scope_to_file(
41 &self,
42 scope_metadata: Self::DIScope,
43 file: &SourceFile,
a1dfa0c6
XL
44 ) -> Self::DIScope;
45 fn debuginfo_finalize(&self);
a1dfa0c6 46
74b04a01
XL
47 // FIXME(eddyb) find a common convention for all of the debuginfo-related
48 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
49 fn create_dbg_var(
50 &self,
f9f354fc 51 variable_name: Symbol,
a1dfa0c6
XL
52 variable_type: Ty<'tcx>,
53 scope_metadata: Self::DIScope,
74b04a01
XL
54 variable_kind: VariableKind,
55 span: Span,
56 ) -> Self::DIVariable;
57}
58
59pub trait DebugInfoBuilderMethods: BackendTypes {
60 // FIXME(eddyb) find a common convention for all of the debuginfo-related
61 // names (choose between `dbg`, `debug`, `debuginfo`, `debug_info` etc.).
62 fn dbg_var_addr(
63 &mut self,
64 dbg_var: Self::DIVariable,
29967ef6 65 dbg_loc: Self::DILocation,
e74abb32
XL
66 variable_alloca: Self::Value,
67 direct_offset: Size,
68 // NB: each offset implies a deref (i.e. they're steps in a pointer chain).
69 indirect_offsets: &[Size],
a1dfa0c6 70 );
29967ef6 71 fn set_dbg_loc(&mut self, dbg_loc: Self::DILocation);
a1dfa0c6 72 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
e74abb32 73 fn set_var_name(&mut self, value: Self::Value, name: &str);
a1dfa0c6 74}