1 use super::BackendTypes;
2 use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
4 use rustc::ty::layout::Size;
5 use rustc::ty::{Instance, Ty};
6 use rustc_hir::def_id::CrateNum;
7 use rustc_span::{SourceFile, Span};
8 use rustc_target::abi::call::FnAbi;
11 pub trait DebugInfoMethods<'tcx>: BackendTypes {
12 fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
14 /// Creates the function-specific debug context.
16 /// Returns the FunctionDebugContext for the function which holds state needed
17 /// for debug info creation, if it is enabled.
18 fn create_function_debug_context(
20 instance: Instance<'tcx>,
21 fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
24 ) -> Option<FunctionDebugContext<Self::DIScope>>;
26 fn extend_scope_to_file(
28 scope_metadata: Self::DIScope,
30 defining_crate: CrateNum,
32 fn debuginfo_finalize(&self);
35 pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
38 dbg_context: &FunctionDebugContext<Self::DIScope>,
40 variable_type: Ty<'tcx>,
41 scope_metadata: Self::DIScope,
42 variable_alloca: Self::Value,
44 // NB: each offset implies a deref (i.e. they're steps in a pointer chain).
45 indirect_offsets: &[Size],
46 variable_kind: VariableKind,
49 fn set_source_location(
51 debug_context: &mut FunctionDebugContext<Self::DIScope>,
55 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
56 fn set_var_name(&mut self, value: Self::Value, name: &str);