rustc: rename mir::VisibilityScope to mir::SourceScope.
This commit is contained in:
parent
74d09399c1
commit
85d44c4276
20 changed files with 193 additions and 191 deletions
|
|
@ -15,7 +15,7 @@ use super::utils::{DIB, span_start};
|
|||
use llvm;
|
||||
use llvm::debuginfo::DIScope;
|
||||
use common::CodegenCx;
|
||||
use rustc::mir::{Mir, VisibilityScope};
|
||||
use rustc::mir::{Mir, SourceScope};
|
||||
|
||||
use libc::c_uint;
|
||||
use std::ptr;
|
||||
|
|
@ -45,13 +45,13 @@ impl MirDebugScope {
|
|||
/// 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(cx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebugContext)
|
||||
-> IndexVec<VisibilityScope, MirDebugScope> {
|
||||
-> IndexVec<SourceScope, MirDebugScope> {
|
||||
let null_scope = MirDebugScope {
|
||||
scope_metadata: ptr::null_mut(),
|
||||
file_start_pos: BytePos(0),
|
||||
file_end_pos: BytePos(0)
|
||||
};
|
||||
let mut scopes = IndexVec::from_elem(null_scope, &mir.visibility_scopes);
|
||||
let mut scopes = IndexVec::from_elem(null_scope, &mir.source_scopes);
|
||||
|
||||
let debug_context = match *debug_context {
|
||||
FunctionDebugContext::RegularContext(ref data) => data,
|
||||
|
|
@ -62,15 +62,15 @@ pub fn create_mir_scopes(cx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebu
|
|||
};
|
||||
|
||||
// Find all the scopes with variables defined in them.
|
||||
let mut has_variables = BitVector::new(mir.visibility_scopes.len());
|
||||
let mut has_variables = BitVector::new(mir.source_scopes.len());
|
||||
for var in mir.vars_iter() {
|
||||
let decl = &mir.local_decls[var];
|
||||
has_variables.insert(decl.source_info.scope.index());
|
||||
}
|
||||
|
||||
// Instantiate all scopes.
|
||||
for idx in 0..mir.visibility_scopes.len() {
|
||||
let scope = VisibilityScope::new(idx);
|
||||
for idx in 0..mir.source_scopes.len() {
|
||||
let scope = SourceScope::new(idx);
|
||||
make_mir_scope(cx, &mir, &has_variables, debug_context, scope, &mut scopes);
|
||||
}
|
||||
|
||||
|
|
@ -81,13 +81,13 @@ fn make_mir_scope(cx: &CodegenCx,
|
|||
mir: &Mir,
|
||||
has_variables: &BitVector,
|
||||
debug_context: &FunctionDebugContextData,
|
||||
scope: VisibilityScope,
|
||||
scopes: &mut IndexVec<VisibilityScope, MirDebugScope>) {
|
||||
scope: SourceScope,
|
||||
scopes: &mut IndexVec<SourceScope, MirDebugScope>) {
|
||||
if scopes[scope].is_valid() {
|
||||
return;
|
||||
}
|
||||
|
||||
let scope_data = &mir.visibility_scopes[scope];
|
||||
let scope_data = &mir.source_scopes[scope];
|
||||
let parent_scope = if let Some(parent) = scope_data.parent_scope {
|
||||
make_mir_scope(cx, mir, has_variables, debug_context, parent, scopes);
|
||||
scopes[parent]
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ pub struct FunctionCx<'a, 'tcx:'a> {
|
|||
locals: IndexVec<mir::Local, LocalRef<'tcx>>,
|
||||
|
||||
/// Debug information for MIR scopes.
|
||||
scopes: IndexVec<mir::VisibilityScope, debuginfo::MirDebugScope>,
|
||||
scopes: IndexVec<mir::SourceScope, debuginfo::MirDebugScope>,
|
||||
|
||||
/// If this function is being monomorphized, this contains the type substitutions used.
|
||||
param_substs: &'tcx Substs<'tcx>,
|
||||
|
|
@ -158,9 +158,9 @@ impl<'a, 'tcx> FunctionCx<'a, 'tcx> {
|
|||
|
||||
// DILocations inherit source file name from the parent DIScope. Due to macro expansions
|
||||
// it may so happen that the current span belongs to a different file than the DIScope
|
||||
// corresponding to span's containing visibility scope. If so, we need to create a DIScope
|
||||
// corresponding to span's containing source scope. If so, we need to create a DIScope
|
||||
// "extension" into that file.
|
||||
fn scope_metadata_for_loc(&self, scope_id: mir::VisibilityScope, pos: BytePos)
|
||||
fn scope_metadata_for_loc(&self, scope_id: mir::SourceScope, pos: BytePos)
|
||||
-> llvm::debuginfo::DIScope {
|
||||
let scope_metadata = self.scopes[scope_id].scope_metadata;
|
||||
if pos < self.scopes[scope_id].file_start_pos ||
|
||||
|
|
@ -411,7 +411,7 @@ fn create_funclets<'a, 'tcx>(
|
|||
/// indirect.
|
||||
fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
||||
fx: &FunctionCx<'a, 'tcx>,
|
||||
scopes: &IndexVec<mir::VisibilityScope, debuginfo::MirDebugScope>,
|
||||
scopes: &IndexVec<mir::SourceScope, debuginfo::MirDebugScope>,
|
||||
memory_locals: &BitVector)
|
||||
-> Vec<LocalRef<'tcx>> {
|
||||
let mir = fx.mir;
|
||||
|
|
@ -420,7 +420,7 @@ fn arg_local_refs<'a, 'tcx>(bx: &Builder<'a, 'tcx>,
|
|||
let mut llarg_idx = fx.fn_ty.ret.is_indirect() as usize;
|
||||
|
||||
// Get the argument scope, if it exists and if we need it.
|
||||
let arg_scope = scopes[mir::ARGUMENT_VISIBILITY_SCOPE];
|
||||
let arg_scope = scopes[mir::OUTERMOST_SOURCE_SCOPE];
|
||||
let arg_scope = if arg_scope.is_valid() && bx.sess().opts.debuginfo == FullDebugInfo {
|
||||
Some(arg_scope.scope_metadata)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue