Navigation Menu

Skip to content

Commit

Permalink
Fix some nits
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Sep 23, 2017
1 parent e130ccc commit 43bfd4c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
32 changes: 13 additions & 19 deletions src/librustc_driver/driver.rs
Expand Up @@ -275,7 +275,11 @@ pub fn compile_input(sess: &Session,
phase5_result);
phase5_result?;

phase_6_link_output::<DefaultTransCrate>(sess, &trans, &outputs);
// Run the linker on any artifacts that resulted from the LLVM run.
// This should produce either a finished executable or library.
time(sess.time_passes(), "linking", || {
DefaultTransCrate::link_binary(sess, &trans, &outputs)
});

// Now that we won't touch anything in the incremental compilation directory
// any more, we can finalize it (which involves renaming it)
Expand Down Expand Up @@ -1112,9 +1116,9 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,

/// Run the translation phase to LLVM, after which the AST and analysis can
/// be discarded.
pub fn phase_4_translate_to_llvm<'a, 'tcx, T: TransCrate>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub fn phase_4_translate_to_llvm<'a, 'tcx, Trans: TransCrate>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
rx: mpsc::Receiver<Box<Any + Send>>)
-> <T as TransCrate>::OngoingCrateTranslation {
-> <Trans as TransCrate>::OngoingCrateTranslation {
let time_passes = tcx.sess.time_passes();

time(time_passes,
Expand All @@ -1123,7 +1127,7 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx, T: TransCrate>(tcx: TyCtxt<'a, 'tcx,

let translation =
time(time_passes, "translation", move || {
T::trans_crate(tcx, rx)
Trans::trans_crate(tcx, rx)
});
if tcx.sess.profile_queries() {
profile::dump("profile_queries".to_string())
Expand All @@ -1134,14 +1138,14 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx, T: TransCrate>(tcx: TyCtxt<'a, 'tcx,

/// Run LLVM itself, producing a bitcode file, assembly file or object file
/// as a side effect.
pub fn phase_5_run_llvm_passes<T: TransCrate>(sess: &Session,
pub fn phase_5_run_llvm_passes<Trans: TransCrate>(sess: &Session,
dep_graph: &DepGraph,
trans: <T as TransCrate>::OngoingCrateTranslation)
-> (CompileResult, <T as TransCrate>::TranslatedCrate) {
let trans = T::join_trans(trans, sess, dep_graph);
trans: <Trans as TransCrate>::OngoingCrateTranslation)
-> (CompileResult, <Trans as TransCrate>::TranslatedCrate) {
let trans = Trans::join_trans(trans, sess, dep_graph);

if sess.opts.debugging_opts.incremental_info {
T::dump_incremental_data(&trans);
Trans::dump_incremental_data(&trans);
}

time(sess.time_passes(),
Expand All @@ -1151,16 +1155,6 @@ pub fn phase_5_run_llvm_passes<T: TransCrate>(sess: &Session,
(sess.compile_status(), trans)
}

/// Run the linker on any artifacts that resulted from the LLVM run.
/// This should produce either a finished executable or library.
pub fn phase_6_link_output<T: TransCrate>(sess: &Session,
trans: &<T as TransCrate>::TranslatedCrate,
outputs: &OutputFilenames) {
time(sess.time_passes(), "linking", || {
T::link_binary(sess, trans, outputs)
});
}

fn escape_dep_filename(filename: &str) -> String {
// Apparently clang and gcc *only* escape spaces:
// http://llvm.org/klaus/clang/commit/9d50634cfc268ecc9a7250226dd5ca0e945240d4
Expand Down
1 change: 0 additions & 1 deletion src/librustc_trans_utils/trans_crate.rs
Expand Up @@ -153,7 +153,6 @@ impl MetadataLoaderTrait for NoLlvmMetadataLoader {
}
}

#[allow(dead_code)]
pub struct MetadataOnlyTransCrate;
pub struct OngoingCrateTranslation {
metadata: EncodedMetadata,
Expand Down

0 comments on commit 43bfd4c

Please sign in to comment.