]> git.lizzy.rs Git - rust.git/blob - src/librustc_codegen_ssa/traits/debuginfo.rs
typeck: remove redundant diverges code
[rust.git] / src / librustc_codegen_ssa / traits / debuginfo.rs
1 use super::BackendTypes;
2 use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
3 use rustc::mir;
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;
9 use syntax::ast::Name;
10
11 pub trait DebugInfoMethods<'tcx>: BackendTypes {
12     fn create_vtable_metadata(&self, ty: Ty<'tcx>, vtable: Self::Value);
13
14     /// Creates the function-specific debug context.
15     ///
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(
19         &self,
20         instance: Instance<'tcx>,
21         fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
22         llfn: Self::Function,
23         mir: &mir::Body<'_>,
24     ) -> Option<FunctionDebugContext<Self::DIScope>>;
25
26     fn extend_scope_to_file(
27         &self,
28         scope_metadata: Self::DIScope,
29         file: &SourceFile,
30         defining_crate: CrateNum,
31     ) -> Self::DIScope;
32     fn debuginfo_finalize(&self);
33 }
34
35 pub trait DebugInfoBuilderMethods<'tcx>: BackendTypes {
36     fn declare_local(
37         &mut self,
38         dbg_context: &FunctionDebugContext<Self::DIScope>,
39         variable_name: Name,
40         variable_type: Ty<'tcx>,
41         scope_metadata: Self::DIScope,
42         variable_alloca: Self::Value,
43         direct_offset: Size,
44         // NB: each offset implies a deref (i.e. they're steps in a pointer chain).
45         indirect_offsets: &[Size],
46         variable_kind: VariableKind,
47         span: Span,
48     );
49     fn set_source_location(
50         &mut self,
51         debug_context: &mut FunctionDebugContext<Self::DIScope>,
52         scope: Self::DIScope,
53         span: Span,
54     );
55     fn insert_reference_to_gdb_debug_scripts_section_global(&mut self);
56     fn set_var_name(&mut self, value: Self::Value, name: &str);
57 }