mv CachingCodemapView CachingSourceMapView

This commit is contained in:
Donato Sciarra 2018-08-18 12:14:25 +02:00
parent 062bfbf39b
commit a2ff845f3a
4 changed files with 13 additions and 13 deletions

View File

@ -23,14 +23,14 @@ struct CacheEntry {
}
#[derive(Clone)]
pub struct CachingCodemapView<'cm> {
pub struct CachingSourceMapView<'cm> {
source_map: &'cm SourceMap,
line_cache: [CacheEntry; 3],
time_stamp: usize,
}
impl<'cm> CachingCodemapView<'cm> {
pub fn new(source_map: &'cm SourceMap) -> CachingCodemapView<'cm> {
impl<'cm> CachingSourceMapView<'cm> {
pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
let files = source_map.files();
let first_file = files[0].clone();
let entry = CacheEntry {
@ -42,7 +42,7 @@ impl<'cm> CachingCodemapView<'cm> {
file_index: 0,
};
CachingCodemapView {
CachingSourceMapView {
source_map,
line_cache: [entry.clone(), entry.clone(), entry.clone()],
time_stamp: 0,

View File

@ -12,7 +12,7 @@ use hir;
use hir::def_id::{DefId, DefIndex};
use hir::map::DefPathHash;
use hir::map::definitions::Definitions;
use ich::{self, CachingCodemapView, Fingerprint};
use ich::{self, CachingSourceMapView, Fingerprint};
use middle::cstore::CrateStore;
use ty::{TyCtxt, fast_reject};
use mir::interpret::AllocId;
@ -57,9 +57,9 @@ pub struct StableHashingContext<'a> {
node_id_hashing_mode: NodeIdHashingMode,
// Very often, we are hashing something that does not need the
// CachingCodemapView, so we initialize it lazily.
// CachingSourceMapView, so we initialize it lazily.
raw_source_map: &'a SourceMap,
caching_source_map: Option<CachingCodemapView<'a>>,
caching_source_map: Option<CachingSourceMapView<'a>>,
pub(super) alloc_id_recursion_tracker: FxHashSet<AllocId>,
}
@ -169,13 +169,13 @@ impl<'a> StableHashingContext<'a> {
}
#[inline]
pub fn source_map(&mut self) -> &mut CachingCodemapView<'a> {
pub fn source_map(&mut self) -> &mut CachingSourceMapView<'a> {
match self.caching_source_map {
Some(ref mut cm) => {
cm
}
ref mut none => {
*none = Some(CachingCodemapView::new(self.raw_source_map));
*none = Some(CachingSourceMapView::new(self.raw_source_map));
none.as_mut().unwrap()
}
}

View File

@ -11,7 +11,7 @@
//! ICH - Incremental Compilation Hash
crate use rustc_data_structures::fingerprint::Fingerprint;
pub use self::caching_codemap_view::CachingCodemapView;
pub use self::caching_codemap_view::CachingSourceMapView;
pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
hash_stable_trait_impls};
mod caching_codemap_view;

View File

@ -14,7 +14,7 @@ use hir;
use hir::def_id::{CrateNum, DefIndex, DefId, LocalDefId,
RESERVED_FOR_INCR_COMP_CACHE, LOCAL_CRATE};
use hir::map::definitions::DefPathHash;
use ich::{CachingCodemapView, Fingerprint};
use ich::{CachingSourceMapView, Fingerprint};
use mir::{self, interpret};
use mir::interpret::{AllocDecodingSession, AllocDecodingState};
use rustc_data_structures::fx::FxHashMap;
@ -196,7 +196,7 @@ impl<'sess> OnDiskCache<'sess> {
expn_info_shorthands: FxHashMap(),
interpret_allocs: FxHashMap(),
interpret_allocs_inverse: Vec::new(),
source_map: CachingCodemapView::new(tcx.sess.source_map()),
source_map: CachingSourceMapView::new(tcx.sess.source_map()),
file_to_file_index,
};
@ -770,7 +770,7 @@ struct CacheEncoder<'enc, 'a, 'tcx, E>
expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
interpret_allocs: FxHashMap<interpret::AllocId, usize>,
interpret_allocs_inverse: Vec<interpret::AllocId>,
source_map: CachingCodemapView<'tcx>,
source_map: CachingSourceMapView<'tcx>,
file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>,
}