Skip to content

Commit 0407eca

Browse files
committed
---
yaml --- r: 4325 b: refs/heads/master c: 840a09c h: refs/heads/master i: 4323: 8c3f435 v: v3
1 parent 05580b4 commit 0407eca

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 5f4b7e1ba7121955ce4805cd55a51bc856d1f5b2
2+
refs/heads/master: 840a09c86ed354be8ed29a0b657bb7289c754442

trunk/src/comp/driver/rustc.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
121121
let time_passes = sess.get_opts().time_passes;
122122
let crate =
123123
time(time_passes, "parsing", bind parse_input(sess, cfg, input));
124-
if sess.get_opts().output_type == link::output_type_none { ret; }
124+
if sess.get_opts().parse_only { ret; }
125125
crate =
126126
time(time_passes, "configuration",
127127
bind front::config::strip_unconfigured_items(crate));
@@ -158,6 +158,7 @@ fn compile_input(sess: session::session, cfg: ast::crate_cfg, input: str,
158158
bind middle::alias::check_crate(ty_cx, crate));
159159
time[()](time_passes, "kind checking",
160160
bind kind::check_crate(ty_cx, crate));
161+
if sess.get_opts().no_trans { ret; }
161162
let llmod =
162163
time[llvm::llvm::ModuleRef](time_passes, "translation",
163164
bind trans::trans_crate(sess, crate,
@@ -258,6 +259,7 @@ options:
258259
--noverify suppress LLVM verification step (slight speedup)
259260
--depend print dependencies, in makefile-rule form
260261
--parse-only parse only; do not compile, assemble, or link
262+
--no-trans run all passes except translation; no output
261263
-g produce debug info
262264
--OptLevel= optimize with possible levels 0-3
263265
-O equivalent to --OptLevel=2
@@ -330,8 +332,11 @@ fn build_session_options(binary: str, match: getopts::match, binary_dir: str)
330332
let lsp_vec = getopts::opt_strs(match, "L");
331333
for lsp: str in lsp_vec { library_search_paths += ~[lsp]; }
332334

335+
let parse_only = opt_present(match, "parse-only");
336+
let no_trans = opt_present(match, "no-trans");
337+
333338
let output_type =
334-
if opt_present(match, "parse-only") {
339+
if parse_only || no_trans {
335340
link::output_type_none
336341
} else if (opt_present(match, "S")) {
337342
link::output_type_assembly
@@ -392,7 +397,9 @@ fn build_session_options(binary: str, match: getopts::match, binary_dir: str)
392397
sysroot: sysroot,
393398
cfg: cfg,
394399
test: test,
395-
dps: dps};
400+
dps: dps,
401+
parse_only: parse_only,
402+
no_trans: no_trans};
396403
ret sopts;
397404
}
398405

@@ -418,6 +425,7 @@ fn opts() -> vec[getopts::opt] {
418425
ret [optflag("h"), optflag("help"), optflag("v"), optflag("version"),
419426
optflag("glue"), optflag("emit-llvm"), optflagopt("pretty"),
420427
optflagopt("expand"), optflag("ls"), optflag("parse-only"),
428+
optflag("no-trans"),
421429
optflag("O"), optopt("OptLevel"), optmulti("L"), optflag("S"),
422430
optflag("c"), optopt("o"), optflag("g"), optflag("save-temps"),
423431
optopt("sysroot"), optflag("stats"), optflag("time-passes"),
@@ -510,7 +518,7 @@ fn main(args: vec[str]) {
510518
vec::pop[str](parts);
511519
saved_out_filename = parts.(0);
512520
alt sopts.output_type {
513-
link::output_type_none. { parts += ["pp"]; }
521+
link::output_type_none. { parts += ["none"]; }
514522
link::output_type_bitcode. { parts += ["bc"]; }
515523
link::output_type_assembly. { parts += ["s"]; }
516524

trunk/src/comp/driver/session.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ type options =
4141
sysroot: str,
4242
cfg: ast::crate_cfg,
4343
test: bool,
44-
dps: bool};
44+
dps: bool,
45+
parse_only: bool,
46+
no_trans: bool
47+
};
4548

4649
type crate_metadata = {name: str, data: u8[]};
4750

0 commit comments

Comments
 (0)