1 use super::BackendTypes;
2 use crate::debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind};
3 use rustc::hir::def_id::CrateNum;
5 use rustc::ty::{self, Ty, Instance};
6 use rustc_index::vec::IndexVec;
8 use syntax_pos::{SourceFile, Span};
10 pub trait DebugInfoMethods<'tcx>: BackendTypes {
11 fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
13 /// Creates the function-specific debug context.
15 /// Returns the FunctionDebugContext for the function which holds state needed
16 /// for debug info creation. The function may also return another variant of the
17 /// FunctionDebugContext enum which indicates why no debuginfo should be created
19 fn create_function_debug_context(
21 instance: Instance<'tcx>,
25 ) -> FunctionDebugContext<Self::DIScope>;
30 debug_context: &mut FunctionDebugContext<Self::DIScope>,
31 ) -> IndexVec<mir::SourceScope, MirDebugScope<Self::DIScope>>;
32 fn extend_scope_to_file(
34 scope_metadata: Self::DIScope,
36 defining_crate: CrateNum,
38 fn debuginfo_finalize(&self);
39 fn debuginfo_upvar_ops_sequence(&self, byte_offset_of_var_in_env: u64) -> [i64; 4];
42 pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
45 dbg_context: &FunctionDebugContext<Self::DIScope>,
47 variable_type: Ty<'tcx>,
48 scope_metadata: Self::DIScope,
49 variable_access: VariableAccess<'_, Self::Value>,
50 variable_kind: VariableKind,
53 fn set_source_location(
55 debug_context: &mut FunctionDebugContext<Self::DIScope>,
56 scope: Option<Self::DIScope>,
59 fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
60 fn set_var_name(&mut self, value: Self::Value, name: impl ToString);