Skip to content

save-analysis: make the dump file's name closer to the crate file's name #29945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/librustc_trans/save/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ use std::fs::{self, File};
use std::path::{Path, PathBuf};

use rustc_front;
use rustc::front::map::NodeItem;
use rustc_front::{hir, lowering};
use rustc::front::map::NodeItem;
use rustc::session::config::CrateType::CrateTypeExecutable;

use syntax::ast::{self, NodeId};
use syntax::ast_util;
Expand Down Expand Up @@ -744,7 +745,14 @@ pub fn process_crate<'l, 'tcx>(tcx: &'l ty::ctxt<'tcx>,
}

// Create output file.
let mut out_name = cratename.to_owned();
let executable = tcx.sess.crate_types.borrow().iter().any(|ct| *ct == CrateTypeExecutable);
let mut out_name = if executable {
"".to_owned()
} else {
"lib".to_owned()
};
out_name.push_str(&cratename);
out_name.push_str(&tcx.sess.opts.cg.extra_filename);
out_name.push_str(".csv");
root_path.push(&out_name);
let output_file = match File::create(&root_path) {
Expand Down