about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/debuginfo
diff options
context:
space:
mode:
authorDenis Merigoux <denis.merigoux@gmail.com>2018-10-03 13:49:57 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-16 15:07:24 +0200
commitc0a428ee702329b0ad818a67a6ecc9617df267c7 (patch)
treec47602d70ccd0f3d54f47e29730e880751afada4 /src/librustc_codegen_llvm/debuginfo
parent915382f7306be7841c4254cee13fa55a865bdd8b (diff)
downloadrust-c0a428ee702329b0ad818a67a6ecc9617df267c7.tar.gz
rust-c0a428ee702329b0ad818a67a6ecc9617df267c7.zip
Great separation of librustc_codegen_llvm: librustc_codegen_ssa compiles
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
-rw-r--r--src/librustc_codegen_llvm/debuginfo/create_scope_map.rs15
-rw-r--r--src/librustc_codegen_llvm/debuginfo/mod.rs71
-rw-r--r--src/librustc_codegen_llvm/debuginfo/source_loc.rs12
3 files changed, 16 insertions, 82 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
index 0fd5f7fb8cd..8eb266f8069 100644
--- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
+++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
@@ -26,21 +26,6 @@ use rustc_data_structures::indexed_vec::{Idx, IndexVec};
 
 use syntax_pos::BytePos;
 
-#[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_some()
-    }
-}
-
 /// Produce DIScope DIEs for each MIR Scope which has variables defined in it.
 /// If debuginfo is disabled, the returned vector is empty.
 pub fn create_mir_scopes(
diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs
index 8ef7350747d..ddd346e99d5 100644
--- a/src/librustc_codegen_llvm/debuginfo/mod.rs
+++ b/src/librustc_codegen_llvm/debuginfo/mod.rs
@@ -111,54 +111,6 @@ impl<'a, 'tcx> CrateDebugContext<'a, 'tcx> {
     }
 }
 
-pub enum FunctionDebugContext<D> {
-    RegularContext(FunctionDebugContextData<D>),
-    DebugInfoDisabled,
-    FunctionWithoutDebugInfo,
-}
-
-impl<D> FunctionDebugContext<D> {
-    pub fn get_ref<'a>(&'a self, span: Span) -> &'a FunctionDebugContextData<D> {
-        match *self {
-            FunctionDebugContext::RegularContext(ref data) => data,
-            FunctionDebugContext::DebugInfoDisabled => {
-                span_bug!(span, "{}", Self::debuginfo_disabled_message());
-            }
-            FunctionDebugContext::FunctionWithoutDebugInfo => {
-                span_bug!(span, "{}", Self::should_be_ignored_message());
-            }
-        }
-    }
-
-    fn debuginfo_disabled_message() -> &'static str {
-        "debuginfo: Error trying to access FunctionDebugContext although debug info is disabled!"
-    }
-
-    fn should_be_ignored_message() -> &'static str {
-        "debuginfo: Error trying to access FunctionDebugContext for function that should be \
-         ignored by debug info!"
-    }
-}
-
-pub struct FunctionDebugContextData<D> {
-    fn_metadata: D,
-    source_locations_enabled: Cell<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,
-}
-
 /// Create any deferred debug metadata nodes
 pub fn finalize(cx: &CodegenCx) {
     if cx.dbg_cx.is_none() {
@@ -578,15 +530,24 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
     }
 
     fn extend_scope_to_file(
-        &self,
-        scope_metadata: &'ll DIScope,
-        file: &syntax_pos::SourceFile,
-        defining_crate: CrateNum,
-    ) -> &'ll DILexicalBlock {
-        metadata::extend_scope_to_file(&self, scope_metadata, file, defining_crate)
-    }
+         &self,
+         scope_metadata: &'ll DIScope,
+         file: &syntax_pos::SourceFile,
+         defining_crate: CrateNum,
+     ) -> &'ll DILexicalBlock {
+         metadata::extend_scope_to_file(&self, scope_metadata, file, defining_crate)
+     }
 
     fn debuginfo_finalize(&self) {
         finalize(self)
     }
+
+    fn debuginfo_upvar_decls_ops_sequence(&self, byte_offset_of_var_in_env: u64) -> &[i64] {
+        unsafe {
+            [llvm::LLVMRustDIBuilderCreateOpDeref(),
+             llvm::LLVMRustDIBuilderCreateOpPlusUconst(),
+             byte_offset_of_var_in_env as i64,
+             llvm::LLVMRustDIBuilderCreateOpDeref()]
+        };
+    }
 }
diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs
index 514649290e2..a4fe912d1d7 100644
--- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs
+++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs
@@ -50,18 +50,6 @@ pub fn set_source_location<D>(
     set_debug_location(bx, dbg_loc);
 }
 
-/// 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: &FunctionDebugContext<D>) {
-    if let FunctionDebugContext::RegularContext(ref data) = *dbg_context {
-        data.source_locations_enabled.set(true);
-    }
-}
-
 
 #[derive(Copy, Clone, PartialEq)]
 pub enum InternalDebugLocation<'ll> {