about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-23 09:30:00 +0000
committerbors <bors@rust-lang.org>2020-03-23 09:30:00 +0000
commit5aa8f199c398644d9fc2bb9ac8cffd14f985686d (patch)
treeb5717a9698a99ed92df9da39c5edd0e0a53ce697 /src/librustc_codegen_llvm/debuginfo/create_scope_map.rs
parent8ff785011be6625e32afceee3a08e5cff7470feb (diff)
parent07e1043222a62443962b6691ff0131e57d73ce2d (diff)
Auto merge of #70305 - Centril:rollup-zi13fz4, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #69080 (rustc_codegen_llvm: don't generate any type debuginfo for -Cdebuginfo=1.)
 - #69940 (librustc_codegen_llvm: Replace deprecated API usage)
 - #69942 (Increase verbosity when suggesting subtle code changes)
 - #69968 (rustc: keep upvars tupled in {Closure,Generator}Substs.)
 - #70123 (Ensure LLVM is in the link path for rustc tools)
 - #70159 (Update the bundled wasi-libc with libstd)
 - #70233 (resolve: Do not resolve visibilities on proc macro definitions twice)
 - #70286 (Miri error type: remove UbExperimental variant)

Failed merges:

r? @ghost
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo/create_scope_map.rs')
-rw-r--r--src/librustc_codegen_llvm/debuginfo/create_scope_map.rs17
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.