From d6dcbcd4e11a1b787a9db1fa43a49907e8bccecf Mon Sep 17 00:00:00 2001 From: Donato Sciarra Date: Sat, 18 Aug 2018 12:13:52 +0200 Subject: mv FileMap SourceFile --- src/librustc_metadata/cstore.rs | 14 +++++++------- src/librustc_metadata/decoder.rs | 22 +++++++++++----------- src/librustc_metadata/encoder.rs | 10 +++++----- src/librustc_metadata/schema.rs | 2 +- 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src/librustc_metadata') diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index 2d3e3080c89..2c95bd82432 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -41,15 +41,15 @@ pub use rustc_data_structures::sync::MetadataRef; pub struct MetadataBlob(pub MetadataRef); -/// Holds information about a syntax_pos::FileMap imported from another crate. +/// Holds information about a syntax_pos::SourceFile imported from another crate. /// See `imported_filemaps()` for more information. -pub struct ImportedFileMap { - /// This FileMap's byte-offset within the codemap of its original crate +pub struct ImportedSourceFile { + /// This SourceFile's byte-offset within the codemap of its original crate pub original_start_pos: syntax_pos::BytePos, - /// The end of this FileMap within the codemap of its original crate + /// The end of this SourceFile within the codemap of its original crate pub original_end_pos: syntax_pos::BytePos, - /// The imported FileMap's representation within the local codemap - pub translated_filemap: Lrc, + /// The imported SourceFile's representation within the local codemap + pub translated_filemap: Lrc, } pub struct CrateMetadata { @@ -64,7 +64,7 @@ pub struct CrateMetadata { pub cnum_map: CrateNumMap, pub cnum: CrateNum, pub dependencies: Lock>, - pub codemap_import_info: RwLock>, + pub codemap_import_info: RwLock>, /// Used for decoding interpret::AllocIds in a cached & thread-safe manner. pub alloc_decoding_state: AllocDecodingState, diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 4a17c5845fd..00ed71c8891 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -1099,26 +1099,26 @@ impl<'a, 'tcx> CrateMetadata { /// /// The import algorithm works analogous to how AST items are inlined from an /// external crate's metadata: - /// For every FileMap in the external codemap an 'inline' copy is created in the + /// For every SourceFile in the external codemap an 'inline' copy is created in the /// local codemap. The correspondence relation between external and local - /// FileMaps is recorded in the `ImportedFileMap` objects returned from this + /// SourceFiles is recorded in the `ImportedSourceFile` objects returned from this /// function. When an item from an external crate is later inlined into this /// crate, this correspondence information is used to translate the span /// information of the inlined item so that it refers the correct positions in /// the local codemap (see `>`). /// - /// The import algorithm in the function below will reuse FileMaps already - /// existing in the local codemap. For example, even if the FileMap of some + /// The import algorithm in the function below will reuse SourceFiles already + /// existing in the local codemap. For example, even if the SourceFile of some /// source file of libstd gets imported many times, there will only ever be - /// one FileMap object for the corresponding file in the local codemap. + /// one SourceFile object for the corresponding file in the local codemap. /// - /// Note that imported FileMaps do not actually contain the source code of the + /// Note that imported SourceFiles do not actually contain the source code of the /// file they represent, just information about length, line breaks, and /// multibyte characters. This information is enough to generate valid debuginfo /// for items inlined from other crates. pub fn imported_filemaps(&'a self, local_codemap: &codemap::SourceMap) - -> ReadGuard<'a, Vec> { + -> ReadGuard<'a, Vec> { { let filemaps = self.codemap_import_info.borrow(); if !filemaps.is_empty() { @@ -1137,9 +1137,9 @@ impl<'a, 'tcx> CrateMetadata { let external_codemap = self.root.codemap.decode(self); let imported_filemaps = external_codemap.map(|filemap_to_import| { - // We can't reuse an existing FileMap, so allocate a new one + // We can't reuse an existing SourceFile, so allocate a new one // containing the information we need. - let syntax_pos::FileMap { name, + let syntax_pos::SourceFile { name, name_was_remapped, src_hash, start_pos, @@ -1156,7 +1156,7 @@ impl<'a, 'tcx> CrateMetadata { // position into frame of reference local to file. // `SourceMap::new_imported_filemap()` will then translate those // coordinates to their new global frame of reference when the - // offset of the FileMap is known. + // offset of the SourceFile is known. for pos in &mut lines { *pos = *pos - start_pos; } @@ -1182,7 +1182,7 @@ impl<'a, 'tcx> CrateMetadata { local_version.name, start_pos, end_pos, local_version.start_pos, local_version.end_pos); - cstore::ImportedFileMap { + cstore::ImportedSourceFile { original_start_pos: start_pos, original_end_pos: end_pos, translated_filemap: local_version, diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 02a41e68f68..925d765ca31 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -42,7 +42,7 @@ use syntax::ast::{self, CRATE_NODE_ID}; use syntax::attr; use syntax::codemap::Spanned; use syntax::symbol::keywords; -use syntax_pos::{self, hygiene, FileName, FileMap, Span}; +use syntax_pos::{self, hygiene, FileName, SourceFile, Span}; use rustc::hir::{self, PatKind}; use rustc::hir::itemlikevisit::ItemLikeVisitor; @@ -62,7 +62,7 @@ pub struct EncodeContext<'a, 'tcx: 'a> { interpret_allocs_inverse: Vec, // This is used to speed up Span encoding. - filemap_cache: Lrc, + filemap_cache: Lrc, } macro_rules! encoder_methods { @@ -337,7 +337,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { self.lazy(definitions.def_path_table()) } - fn encode_codemap(&mut self) -> LazySeq { + fn encode_codemap(&mut self) -> LazySeq { let codemap = self.tcx.sess.codemap(); let all_filemaps = codemap.files(); @@ -350,7 +350,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { !filemap.is_imported() }) .map(|filemap| { - // When exporting FileMaps, we expand all paths to absolute + // When exporting SourceFiles, we expand all paths to absolute // paths because any relative paths are potentially relative to // a wrong directory. // However, if a path has been modified via @@ -361,7 +361,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { FileName::Real(ref name) => { if filemap.name_was_remapped || (name.is_relative() && working_dir_was_remapped) { - // This path of this FileMap has been modified by + // This path of this SourceFile has been modified by // path-remapping, so we use it verbatim (and avoid cloning // the whole map in the process). filemap.clone() diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index 781652e1985..520273487a9 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -204,7 +204,7 @@ pub struct CrateRoot { pub lang_items_missing: LazySeq, pub native_libraries: LazySeq, pub foreign_modules: LazySeq, - pub codemap: LazySeq, + pub codemap: LazySeq, pub def_path_table: Lazy, pub impls: LazySeq, pub exported_symbols: EncodedExportedSymbols, -- cgit 1.4.1-3-g733a5