Persist ThinLTO import data in incr. comp. session directory.

This commit is contained in:
Michael Woerister 2018-08-17 16:07:23 +02:00
parent 2e587df6e2
commit d97d1e192b
5 changed files with 139 additions and 4 deletions

View file

@ -29,6 +29,7 @@ use super::ModuleCodegen;
use super::ModuleKind;
use abi;
use back::lto;
use back::write::{self, OngoingCodegen};
use llvm::{self, TypeKind, get_param};
use metadata;
@ -1314,6 +1315,25 @@ pub fn visibility_to_llvm(linkage: Visibility) -> llvm::Visibility {
}
}
#[allow(unused)]
fn load_thin_lto_imports(sess: &Session) -> lto::ThinLTOImports {
let path = rustc_incremental::in_incr_comp_dir_sess(
sess,
lto::THIN_LTO_IMPORTS_INCR_COMP_FILE_NAME
);
if !path.exists() {
return lto::ThinLTOImports::new();
}
match lto::ThinLTOImports::load_from_file(&path) {
Ok(imports) => imports,
Err(e) => {
let msg = format!("Error while trying to load ThinLTO import data \
for incremental compilation: {}", e);
sess.fatal(&msg)
}
}
}
// FIXME(mw): Anything that is produced via DepGraph::with_task() must implement
// the HashStable trait. Normally DepGraph::with_task() calls are
// hidden behind queries, but CGU creation is a special case in two