diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-02-08 18:27:49 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-02-08 18:27:49 +0200 |
| commit | bdb72e7b5ac304c918710ec5c968eaece7e6b57c (patch) | |
| tree | 166bf4e3f77a92a874a654168e794d283ef02323 /src/librustc_codegen_llvm/debuginfo | |
| parent | 1385fc4c40cb96eca5f3df2c3043425889073646 (diff) | |
| download | rust-bdb72e7b5ac304c918710ec5c968eaece7e6b57c.tar.gz rust-bdb72e7b5ac304c918710ec5c968eaece7e6b57c.zip | |
rustc_codegen_ssa: remove unnecessary source_locations_enabled.
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/mod.rs | 17 | ||||
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/source_loc.rs | 24 |
2 files changed, 8 insertions, 33 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 46f186191e3..c1a7bb50878 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -51,7 +51,6 @@ mod utils; pub use self::create_scope_map::compute_mir_scopes; pub use self::metadata::create_global_var_metadata; pub use self::metadata::extend_scope_to_file; -pub use self::source_loc::set_source_location; #[allow(non_upper_case_globals)] const DW_TAG_auto_variable: c_uint = 0x100; @@ -193,13 +192,14 @@ impl DebugInfoBuilderMethods for Builder<'a, 'll, 'tcx> { } } - fn set_source_location( - &mut self, - debug_context: &mut FunctionDebugContext<&'ll DIScope>, - scope: &'ll DIScope, - span: Span, - ) { - set_source_location(debug_context, &self, scope, span) + fn set_source_location(&mut self, scope: &'ll DIScope, span: Span) { + debug!("set_source_location: {}", self.sess().source_map().span_to_string(span)); + + let dbg_loc = self.cx().create_debug_loc(scope, span); + + unsafe { + llvm::LLVMSetCurrentDebugLocation(self.llbuilder, dbg_loc); + } } fn insert_reference_to_gdb_debug_scripts_section_global(&mut self) { gdb::insert_reference_to_gdb_debug_scripts_section_global(self) @@ -333,7 +333,6 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { }; let mut fn_debug_context = FunctionDebugContext { scopes: IndexVec::from_elem(null_scope, &mir.source_scopes), - source_locations_enabled: false, defining_crate: def_id.krate, }; diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs index 78dc1ac250e..1f871c7d207 100644 --- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -1,38 +1,14 @@ use super::metadata::UNKNOWN_COLUMN_NUMBER; use super::utils::{debug_context, span_start}; -use rustc_codegen_ssa::mir::debuginfo::FunctionDebugContext; -use crate::builder::Builder; use crate::common::CodegenCx; use crate::llvm::debuginfo::DIScope; use crate::llvm::{self, Value}; -use log::debug; use rustc_codegen_ssa::traits::*; use libc::c_uint; use rustc_span::{Pos, Span}; -/// Sets the current debug location at the beginning of the span. -/// -/// Maps to a call to llvm::LLVMSetCurrentDebugLocation(...). -pub fn set_source_location<D>( - debug_context: &FunctionDebugContext<D>, - bx: &Builder<'_, 'll, '_>, - scope: &'ll DIScope, - span: Span, -) { - let dbg_loc = if debug_context.source_locations_enabled { - debug!("set_source_location: {}", bx.sess().source_map().span_to_string(span)); - Some(bx.cx().create_debug_loc(scope, span)) - } else { - None - }; - - unsafe { - llvm::LLVMSetCurrentDebugLocation(bx.llbuilder, dbg_loc); - } -} - impl CodegenCx<'ll, '_> { pub fn create_debug_loc(&self, scope: &'ll DIScope, span: Span) -> &'ll Value { let loc = span_start(self, span); |
