diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-02-11 22:52:59 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2020-03-23 02:36:35 +0200 |
| commit | 70239484001f91fcf847a0df6aff79d94991952a (patch) | |
| tree | 749d9d8d5d5d9371e359421ebe431d4558217377 | |
| parent | d1e81ef234ff5c2e0e3a69cb4e8e5f5b0fe1fd83 (diff) | |
| download | rust-70239484001f91fcf847a0df6aff79d94991952a.tar.gz rust-70239484001f91fcf847a0df6aff79d94991952a.zip | |
rustc_codegen_llvm: don't generate "lexical block" scopes for -Cdebuginfo=1.
| -rw-r--r-- | src/librustc_codegen_llvm/debuginfo/create_scope_map.rs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs index 09422f4ec37..13a36c36a30 100644 --- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs +++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs @@ -1,11 +1,13 @@ use super::metadata::{file_metadata, UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER}; use super::utils::DIB; use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext}; +use rustc_codegen_ssa::traits::*; use crate::common::CodegenCx; use crate::llvm; use crate::llvm::debuginfo::{DIScope, DISubprogram}; use rustc::mir::{Body, SourceScope}; +use rustc_session::config::DebugInfo; use rustc_index::bit_set::BitSet; use rustc_index::vec::Idx; @@ -19,10 +21,17 @@ pub fn compute_mir_scopes( ) { // Find all the scopes with variables defined in them. let mut has_variables = BitSet::new_empty(mir.source_scopes.len()); - // FIXME(eddyb) take into account that arguments always have debuginfo, - // irrespective of their name (assuming full debuginfo is enabled). - for var_debug_info in &mir.var_debug_info { - has_variables.insert(var_debug_info.source_info.scope); + + // Only consider variables when they're going to be emitted. + // FIXME(eddyb) don't even allocate `has_variables` otherwise. + if cx.sess().opts.debuginfo == DebugInfo::Full { + // FIXME(eddyb) take into account that arguments always have debuginfo, + // irrespective of their name (assuming full debuginfo is enabled). + // NOTE(eddyb) actually, on second thought, those are always in the + // function scope, which always exists. + for var_debug_info in &mir.var_debug_info { + has_variables.insert(var_debug_info.source_info.scope); + } } // Instantiate all scopes. |
