rustc: Fix style of OutputType enum

This commit is contained in:
Brian Anderson 2014-01-09 17:42:08 -08:00
parent ff3d5d4603
commit 520c82e0e9
4 changed files with 41 additions and 41 deletions

View File

@ -45,13 +45,13 @@ use syntax::attr::AttrMetaMethods;
use syntax::crateid::CrateId;
#[deriving(Clone, Eq)]
pub enum output_type {
output_type_none,
output_type_bitcode,
output_type_assembly,
output_type_llvm_assembly,
output_type_object,
output_type_exe,
pub enum OutputType {
OutputTypeNone,
OutputTypeBitcode,
OutputTypeAssembly,
OutputTypeLlvmAssembly,
OutputTypeObject,
OutputTypeExe,
}
pub fn llvm_err(sess: Session, msg: ~str) -> ! {
@ -86,10 +86,10 @@ pub fn WriteOutputFile(
pub mod write {
use back::lto;
use back::link::{WriteOutputFile, output_type};
use back::link::{output_type_assembly, output_type_bitcode};
use back::link::{output_type_exe, output_type_llvm_assembly};
use back::link::{output_type_object};
use back::link::{WriteOutputFile, OutputType};
use back::link::{OutputTypeAssembly, OutputTypeBitcode};
use back::link::{OutputTypeExe, OutputTypeLlvmAssembly};
use back::link::{OutputTypeObject};
use driver::driver::CrateTranslation;
use driver::session::Session;
use driver::session;
@ -107,7 +107,7 @@ pub mod write {
pub fn run_passes(sess: Session,
trans: &CrateTranslation,
output_type: output_type,
output_type: OutputType,
output: &Path) {
let llmod = trans.module;
let llcx = trans.context;
@ -225,20 +225,20 @@ pub mod write {
time(sess.time_passes(), "codegen passes", (), |()| {
match output_type {
output_type_none => {}
output_type_bitcode => {
OutputTypeNone => {}
OutputTypeBitcode => {
output.with_c_str(|buf| {
llvm::LLVMWriteBitcodeToFile(llmod, buf);
})
}
output_type_llvm_assembly => {
OutputTypeLlvmAssembly => {
output.with_c_str(|output| {
with_codegen(tm, llmod, |cpm| {
llvm::LLVMRustPrintModule(cpm, llmod, output);
})
})
}
output_type_assembly => {
OutputTypeAssembly => {
with_codegen(tm, llmod, |cpm| {
WriteOutputFile(sess, tm, cpm, llmod, output,
lib::llvm::AssemblyFile);
@ -248,7 +248,7 @@ pub mod write {
// could be invoked specially with output_type_assembly,
// so in this case we still want the metadata object
// file.
if sess.opts.output_type != output_type_assembly {
if sess.opts.output_type != OutputTypeAssembly {
with_codegen(tm, trans.metadata_module, |cpm| {
let out = output.with_extension("metadata.o");
WriteOutputFile(sess, tm, cpm,
@ -257,7 +257,7 @@ pub mod write {
})
}
}
output_type_exe | output_type_object => {
OutputTypeExe | OutputTypeObject => {
with_codegen(tm, llmod, |cpm| {
WriteOutputFile(sess, tm, cpm, llmod, output,
lib::llvm::ObjectFile);

View File

@ -362,7 +362,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
outputs: &OutputFilenames) {
if sess.no_integrated_as() {
let output_type = link::output_type_assembly;
let output_type = link::OutputTypeAssembly;
let asm_filename = outputs.obj_filename.with_extension("s");
time(sess.time_passes(), "LLVM passes", (), |_|
@ -424,7 +424,7 @@ pub fn stop_after_phase_2(sess: Session) -> bool {
}
pub fn stop_after_phase_5(sess: Session) -> bool {
if sess.opts.output_type != link::output_type_exe {
if sess.opts.output_type != link::OutputTypeExe {
debug!("not building executable, returning early from compile_input");
return true;
}
@ -765,17 +765,17 @@ pub fn build_session_options(binary: ~str,
let output_type =
if parse_only || no_trans {
link::output_type_none
link::OutputTypeNone
} else if matches.opt_present("S") &&
matches.opt_present("emit-llvm") {
link::output_type_llvm_assembly
link::OutputTypeLlvmAssembly
} else if matches.opt_present("S") {
link::output_type_assembly
link::OutputTypeAssembly
} else if matches.opt_present("c") {
link::output_type_object
link::OutputTypeObject
} else if matches.opt_present("emit-llvm") {
link::output_type_bitcode
} else { link::output_type_exe };
link::OutputTypeBitcode
} else { link::OutputTypeExe };
let sysroot_opt = matches.opt_str("sysroot").map(|m| @Path::new(m));
let target = matches.opt_str("target").unwrap_or(host_triple());
let target_cpu = matches.opt_str("target-cpu").unwrap_or(~"generic");
@ -1039,15 +1039,15 @@ pub fn build_output_filenames(input: &input,
let obj_path;
let out_path;
let sopts = sess.opts;
let stop_after_codegen = sopts.output_type != link::output_type_exe;
let stop_after_codegen = sopts.output_type != link::OutputTypeExe;
let obj_suffix = match sopts.output_type {
link::output_type_none => ~"none",
link::output_type_bitcode => ~"bc",
link::output_type_assembly => ~"s",
link::output_type_llvm_assembly => ~"ll",
link::OutputTypeNone => ~"none",
link::OutputTypeBitcode => ~"bc",
link::OutputTypeAssembly => ~"s",
link::OutputTypeLlvmAssembly => ~"ll",
// Object and exe output both use the '.o' extension here
link::output_type_object | link::output_type_exe => ~"o"
link::OutputTypeObject | link::OutputTypeExe => ~"o"
};
match *ofile {

View File

@ -147,7 +147,7 @@ pub struct options {
extra_debuginfo: bool,
lint_opts: ~[(lint::lint, lint::level)],
save_temps: bool,
output_type: back::link::output_type,
output_type: back::link::OutputType,
// This is mutable for rustpkg, which updates search paths based on the
// parsed code.
addl_lib_search_paths: @RefCell<HashSet<Path>>,
@ -385,7 +385,7 @@ pub fn basic_options() -> @options {
extra_debuginfo: false,
lint_opts: ~[],
save_temps: false,
output_type: link::output_type_exe,
output_type: link::OutputTypeExe,
addl_lib_search_paths: @RefCell::new(HashSet::new()),
ar: None,
linker: None,

View File

@ -26,7 +26,7 @@ use syntax::attr::AttrMetaMethods;
use syntax::fold::Folder;
use syntax::visit::Visitor;
use syntax::util::small_vector::SmallVector;
use rustc::back::link::output_type_exe;
use rustc::back::link::OutputTypeExe;
use rustc::back::link;
use CtxMethods;
use context::{in_target, StopBefore, Link, Assemble, BuildContext};
@ -219,12 +219,12 @@ pub fn compile_input(context: &BuildContext,
debug!("sysroot_to_use = {}", sysroot_to_use.display());
let output_type = match context.compile_upto() {
Assemble => link::output_type_assembly,
Link => link::output_type_object,
Pretty | Trans | Analysis => link::output_type_none,
LLVMAssemble => link::output_type_llvm_assembly,
LLVMCompileBitcode => link::output_type_bitcode,
Nothing => link::output_type_exe
Assemble => link::OutputTypeAssembly,
Link => link::OutputTypeObject,
Pretty | Trans | Analysis => link::OutputTypeNone,
LLVMAssemble => link::OutputTypeLlvmAssembly,
LLVMCompileBitcode => link::OutputTypeBitcode,
Nothing => link::OutputTypeExe
};
debug!("Output type = {:?}", output_type);