librustc: De-@mut outputs in the session

This commit is contained in:
Patrick Walton 2013-12-22 14:51:06 -08:00
parent e4815b6c3f
commit f62faa89ed
4 changed files with 9 additions and 6 deletions

View File

@ -208,8 +208,9 @@ pub mod write {
// Emit the bytecode if we're either saving our temporaries or
// emitting an rlib. Whenever an rlib is create, the bytecode is
// inserted into the archive in order to allow LTO against it.
let outputs = sess.outputs.borrow();
if sess.opts.save_temps ||
sess.outputs.iter().any(|&o| o == session::OutputRlib) {
outputs.get().iter().any(|&o| o == session::OutputRlib) {
output.with_extension("bc").with_c_str(|buf| {
llvm::LLVMWriteBitcodeToFile(llmod, buf);
})
@ -745,7 +746,8 @@ pub fn link_binary(sess: Session,
out_filename: &Path,
lm: &LinkMeta) -> ~[Path] {
let mut out_filenames = ~[];
for &output in sess.outputs.iter() {
let outputs = sess.outputs.borrow();
for &output in outputs.get().iter() {
let out_file = link_binary_output(sess, trans, output, obj_filename,
out_filename, lm);
out_filenames.push(out_file);

View File

@ -20,7 +20,8 @@ use std::libc;
pub fn run(sess: session::Session, llmod: ModuleRef,
tm: TargetMachineRef, reachable: &[~str]) {
// Make sure we actually can run LTO
for output in sess.outputs.iter() {
let outputs = sess.outputs.borrow();
for output in outputs.get().iter() {
match *output {
session::OutputExecutable | session::OutputStaticlib => {}
_ => {

View File

@ -167,7 +167,7 @@ pub fn phase_2_configure_and_expand(sess: Session,
let time_passes = sess.time_passes();
sess.building_library.set(session::building_library(sess.opts, &crate));
*sess.outputs = session::collect_outputs(sess.opts, crate.attrs);
sess.outputs.set(session::collect_outputs(sess.opts, crate.attrs));
time(time_passes, "gated feature checking", (), |_|
front::feature_gate::check_crate(sess, &crate));
@ -882,7 +882,7 @@ pub fn build_session_(sopts: @session::options,
working_dir: os::getcwd(),
lints: RefCell::new(HashMap::new()),
node_id: Cell::new(1),
outputs: @mut ~[],
outputs: @RefCell::new(~[]),
}
}

View File

@ -215,7 +215,7 @@ pub struct Session_ {
lints: RefCell<HashMap<ast::NodeId,
~[(lint::lint, codemap::Span, ~str)]>>,
node_id: Cell<ast::NodeId>,
outputs: @mut ~[OutputStyle],
outputs: @RefCell<~[OutputStyle]>,
}
pub type Session = @Session_;