rustc_mir: track inlined callees in SourceScopeData.

This commit is contained in:
Eduard-Mihai Burtescu 2020-02-08 21:31:09 +02:00
parent 708fc0b692
commit 6bc5eafbce
41 changed files with 124 additions and 74 deletions

View file

@ -161,7 +161,7 @@ pub struct Body<'tcx> {
/// A list of source scopes; these are referenced by statements
/// and used for debuginfo. Indexed by a `SourceScope`.
pub source_scopes: IndexVec<SourceScope, SourceScopeData>,
pub source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
/// The yield type of the function, if it is a generator.
pub yield_ty: Option<Ty<'tcx>>,
@ -244,7 +244,7 @@ impl<'tcx> Body<'tcx> {
pub fn new(
source: MirSource<'tcx>,
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
source_scopes: IndexVec<SourceScope, SourceScopeData>,
source_scopes: IndexVec<SourceScope, SourceScopeData<'tcx>>,
local_decls: LocalDecls<'tcx>,
user_type_annotations: ty::CanonicalUserTypeAnnotations<'tcx>,
arg_count: usize,
@ -1868,11 +1868,16 @@ rustc_index::newtype_index! {
}
}
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable)]
pub struct SourceScopeData {
#[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable)]
pub struct SourceScopeData<'tcx> {
pub span: Span,
pub parent_scope: Option<SourceScope>,
/// Whether this scope is the root of a scope tree of another body,
/// inlined into this body by the MIR inliner.
/// `ty::Instance` is the callee, and the `Span` is the call site.
pub inlined: Option<(ty::Instance<'tcx>, Span)>,
/// Crate-local information for this source scope, that can't (and
/// needn't) be tracked across crates.
pub local_data: ClearCrossCrate<SourceScopeLocalData>,