Skip to content

Commit

Permalink
rustc_codegen_llvm: don't generate "lexical block" scopes for -Cdebug…
Browse files Browse the repository at this point in the history
…info=1.
  • Loading branch information
eddyb committed Mar 23, 2020
1 parent d1e81ef commit 7023948
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions 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;
Expand All @@ -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.
Expand Down

0 comments on commit 7023948

Please sign in to comment.