Skip to content

Commit 520c82e

Browse files
committed
rustc: Fix style of OutputType enum
1 parent ff3d5d4 commit 520c82e

File tree

4 files changed

+41
-41
lines changed

4 files changed

+41
-41
lines changed

src/librustc/back/link.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ use syntax::attr::AttrMetaMethods;
4545
use syntax::crateid::CrateId;
4646

4747
#[deriving(Clone, Eq)]
48-
pub enum output_type {
49-
output_type_none,
50-
output_type_bitcode,
51-
output_type_assembly,
52-
output_type_llvm_assembly,
53-
output_type_object,
54-
output_type_exe,
48+
pub enum OutputType {
49+
OutputTypeNone,
50+
OutputTypeBitcode,
51+
OutputTypeAssembly,
52+
OutputTypeLlvmAssembly,
53+
OutputTypeObject,
54+
OutputTypeExe,
5555
}
5656

5757
pub fn llvm_err(sess: Session, msg: ~str) -> ! {
@@ -86,10 +86,10 @@ pub fn WriteOutputFile(
8686
pub mod write {
8787

8888
use back::lto;
89-
use back::link::{WriteOutputFile, output_type};
90-
use back::link::{output_type_assembly, output_type_bitcode};
91-
use back::link::{output_type_exe, output_type_llvm_assembly};
92-
use back::link::{output_type_object};
89+
use back::link::{WriteOutputFile, OutputType};
90+
use back::link::{OutputTypeAssembly, OutputTypeBitcode};
91+
use back::link::{OutputTypeExe, OutputTypeLlvmAssembly};
92+
use back::link::{OutputTypeObject};
9393
use driver::driver::CrateTranslation;
9494
use driver::session::Session;
9595
use driver::session;
@@ -107,7 +107,7 @@ pub mod write {
107107

108108
pub fn run_passes(sess: Session,
109109
trans: &CrateTranslation,
110-
output_type: output_type,
110+
output_type: OutputType,
111111
output: &Path) {
112112
let llmod = trans.module;
113113
let llcx = trans.context;
@@ -225,20 +225,20 @@ pub mod write {
225225

226226
time(sess.time_passes(), "codegen passes", (), |()| {
227227
match output_type {
228-
output_type_none => {}
229-
output_type_bitcode => {
228+
OutputTypeNone => {}
229+
OutputTypeBitcode => {
230230
output.with_c_str(|buf| {
231231
llvm::LLVMWriteBitcodeToFile(llmod, buf);
232232
})
233233
}
234-
output_type_llvm_assembly => {
234+
OutputTypeLlvmAssembly => {
235235
output.with_c_str(|output| {
236236
with_codegen(tm, llmod, |cpm| {
237237
llvm::LLVMRustPrintModule(cpm, llmod, output);
238238
})
239239
})
240240
}
241-
output_type_assembly => {
241+
OutputTypeAssembly => {
242242
with_codegen(tm, llmod, |cpm| {
243243
WriteOutputFile(sess, tm, cpm, llmod, output,
244244
lib::llvm::AssemblyFile);
@@ -248,7 +248,7 @@ pub mod write {
248248
// could be invoked specially with output_type_assembly,
249249
// so in this case we still want the metadata object
250250
// file.
251-
if sess.opts.output_type != output_type_assembly {
251+
if sess.opts.output_type != OutputTypeAssembly {
252252
with_codegen(tm, trans.metadata_module, |cpm| {
253253
let out = output.with_extension("metadata.o");
254254
WriteOutputFile(sess, tm, cpm,
@@ -257,7 +257,7 @@ pub mod write {
257257
})
258258
}
259259
}
260-
output_type_exe | output_type_object => {
260+
OutputTypeExe | OutputTypeObject => {
261261
with_codegen(tm, llmod, |cpm| {
262262
WriteOutputFile(sess, tm, cpm, llmod, output,
263263
lib::llvm::ObjectFile);

src/librustc/driver/driver.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
362362
outputs: &OutputFilenames) {
363363

364364
if sess.no_integrated_as() {
365-
let output_type = link::output_type_assembly;
365+
let output_type = link::OutputTypeAssembly;
366366
let asm_filename = outputs.obj_filename.with_extension("s");
367367

368368
time(sess.time_passes(), "LLVM passes", (), |_|
@@ -424,7 +424,7 @@ pub fn stop_after_phase_2(sess: Session) -> bool {
424424
}
425425

426426
pub fn stop_after_phase_5(sess: Session) -> bool {
427-
if sess.opts.output_type != link::output_type_exe {
427+
if sess.opts.output_type != link::OutputTypeExe {
428428
debug!("not building executable, returning early from compile_input");
429429
return true;
430430
}
@@ -765,17 +765,17 @@ pub fn build_session_options(binary: ~str,
765765

766766
let output_type =
767767
if parse_only || no_trans {
768-
link::output_type_none
768+
link::OutputTypeNone
769769
} else if matches.opt_present("S") &&
770770
matches.opt_present("emit-llvm") {
771-
link::output_type_llvm_assembly
771+
link::OutputTypeLlvmAssembly
772772
} else if matches.opt_present("S") {
773-
link::output_type_assembly
773+
link::OutputTypeAssembly
774774
} else if matches.opt_present("c") {
775-
link::output_type_object
775+
link::OutputTypeObject
776776
} else if matches.opt_present("emit-llvm") {
777-
link::output_type_bitcode
778-
} else { link::output_type_exe };
777+
link::OutputTypeBitcode
778+
} else { link::OutputTypeExe };
779779
let sysroot_opt = matches.opt_str("sysroot").map(|m| @Path::new(m));
780780
let target = matches.opt_str("target").unwrap_or(host_triple());
781781
let target_cpu = matches.opt_str("target-cpu").unwrap_or(~"generic");
@@ -1039,15 +1039,15 @@ pub fn build_output_filenames(input: &input,
10391039
let obj_path;
10401040
let out_path;
10411041
let sopts = sess.opts;
1042-
let stop_after_codegen = sopts.output_type != link::output_type_exe;
1042+
let stop_after_codegen = sopts.output_type != link::OutputTypeExe;
10431043

10441044
let obj_suffix = match sopts.output_type {
1045-
link::output_type_none => ~"none",
1046-
link::output_type_bitcode => ~"bc",
1047-
link::output_type_assembly => ~"s",
1048-
link::output_type_llvm_assembly => ~"ll",
1045+
link::OutputTypeNone => ~"none",
1046+
link::OutputTypeBitcode => ~"bc",
1047+
link::OutputTypeAssembly => ~"s",
1048+
link::OutputTypeLlvmAssembly => ~"ll",
10491049
// Object and exe output both use the '.o' extension here
1050-
link::output_type_object | link::output_type_exe => ~"o"
1050+
link::OutputTypeObject | link::OutputTypeExe => ~"o"
10511051
};
10521052

10531053
match *ofile {

src/librustc/driver/session.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pub struct options {
147147
extra_debuginfo: bool,
148148
lint_opts: ~[(lint::lint, lint::level)],
149149
save_temps: bool,
150-
output_type: back::link::output_type,
150+
output_type: back::link::OutputType,
151151
// This is mutable for rustpkg, which updates search paths based on the
152152
// parsed code.
153153
addl_lib_search_paths: @RefCell<HashSet<Path>>,
@@ -385,7 +385,7 @@ pub fn basic_options() -> @options {
385385
extra_debuginfo: false,
386386
lint_opts: ~[],
387387
save_temps: false,
388-
output_type: link::output_type_exe,
388+
output_type: link::OutputTypeExe,
389389
addl_lib_search_paths: @RefCell::new(HashSet::new()),
390390
ar: None,
391391
linker: None,

src/librustpkg/util.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use syntax::attr::AttrMetaMethods;
2626
use syntax::fold::Folder;
2727
use syntax::visit::Visitor;
2828
use syntax::util::small_vector::SmallVector;
29-
use rustc::back::link::output_type_exe;
29+
use rustc::back::link::OutputTypeExe;
3030
use rustc::back::link;
3131
use CtxMethods;
3232
use context::{in_target, StopBefore, Link, Assemble, BuildContext};
@@ -219,12 +219,12 @@ pub fn compile_input(context: &BuildContext,
219219
debug!("sysroot_to_use = {}", sysroot_to_use.display());
220220

221221
let output_type = match context.compile_upto() {
222-
Assemble => link::output_type_assembly,
223-
Link => link::output_type_object,
224-
Pretty | Trans | Analysis => link::output_type_none,
225-
LLVMAssemble => link::output_type_llvm_assembly,
226-
LLVMCompileBitcode => link::output_type_bitcode,
227-
Nothing => link::output_type_exe
222+
Assemble => link::OutputTypeAssembly,
223+
Link => link::OutputTypeObject,
224+
Pretty | Trans | Analysis => link::OutputTypeNone,
225+
LLVMAssemble => link::OutputTypeLlvmAssembly,
226+
LLVMCompileBitcode => link::OutputTypeBitcode,
227+
Nothing => link::OutputTypeExe
228228
};
229229

230230
debug!("Output type = {:?}", output_type);

0 commit comments

Comments
 (0)