diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-09-04 19:44:58 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-31 20:00:15 +0200 |
| commit | 5059a3c7d4afd00458d5bd2f033a0b9c91bd8bf8 (patch) | |
| tree | f42d86de1d8add544f96070b711f7132c1007fa2 /src/librustc_codegen_ssa/debuginfo | |
| parent | 92df638162b7ccea6f97a8e1287ed05c5c0818b4 (diff) | |
| download | rust-5059a3c7d4afd00458d5bd2f033a0b9c91bd8bf8.tar.gz rust-5059a3c7d4afd00458d5bd2f033a0b9c91bd8bf8.zip | |
rustc_codegen_ssa: move debuginfo-related things to a new mir::debuginfo module.
Diffstat (limited to 'src/librustc_codegen_ssa/debuginfo')
| -rw-r--r-- | src/librustc_codegen_ssa/debuginfo/mod.rs | 82 |
1 files changed, 1 insertions, 81 deletions
diff --git a/src/librustc_codegen_ssa/debuginfo/mod.rs b/src/librustc_codegen_ssa/debuginfo/mod.rs index c9b1c0260e8..d1a0cf78d6a 100644 --- a/src/librustc_codegen_ssa/debuginfo/mod.rs +++ b/src/librustc_codegen_ssa/debuginfo/mod.rs @@ -1,82 +1,2 @@ -use syntax_pos::{BytePos, Span}; -use rustc::hir::def_id::CrateNum; - +// FIXME(eddyb) find a place for this (or a way to replace it). pub mod type_names; - -pub enum FunctionDebugContext<D> { - RegularContext(FunctionDebugContextData<D>), - DebugInfoDisabled, - FunctionWithoutDebugInfo, -} - -impl<D> FunctionDebugContext<D> { - pub fn get_ref(&self, span: Span) -> &FunctionDebugContextData<D> { - match *self { - FunctionDebugContext::RegularContext(ref data) => data, - FunctionDebugContext::DebugInfoDisabled => { - span_bug!( - span, - "debuginfo: Error trying to access FunctionDebugContext \ - although debug info is disabled!", - ); - } - FunctionDebugContext::FunctionWithoutDebugInfo => { - span_bug!( - span, - "debuginfo: Error trying to access FunctionDebugContext \ - for function that should be ignored by debug info!", - ); - } - } - } -} - -/// Enables emitting source locations for the given functions. -/// -/// Since we don't want source locations to be emitted for the function prelude, -/// they are disabled when beginning to codegen a new function. This functions -/// switches source location emitting on and must therefore be called before the -/// first real statement/expression of the function is codegened. -pub fn start_emitting_source_locations<D>(dbg_context: &mut FunctionDebugContext<D>) { - match *dbg_context { - FunctionDebugContext::RegularContext(ref mut data) => { - data.source_locations_enabled = true; - }, - _ => { /* safe to ignore */ } - } -} - -pub struct FunctionDebugContextData<D> { - pub fn_metadata: D, - pub source_locations_enabled: bool, - pub defining_crate: CrateNum, -} - -pub enum VariableAccess<'a, V> { - // The llptr given is an alloca containing the variable's value - DirectVariable { alloca: V }, - // The llptr given is an alloca containing the start of some pointer chain - // leading to the variable's content. - IndirectVariable { alloca: V, address_operations: &'a [i64] } -} - -pub enum VariableKind { - ArgumentVariable(usize /*index*/), - LocalVariable, -} - - -#[derive(Clone, Copy, Debug)] -pub struct MirDebugScope<D> { - pub scope_metadata: Option<D>, - // Start and end offsets of the file to which this DIScope belongs. - // These are used to quickly determine whether some span refers to the same file. - pub file_start_pos: BytePos, - pub file_end_pos: BytePos, -} - -impl<D> MirDebugScope<D> { - pub fn is_valid(&self) -> bool { - !self.scope_metadata.is_none() - } -} |
