diff options
| author | Marijn Haverbeke <[email protected]> | 2011-04-07 23:55:02 +0200 |
|---|---|---|
| committer | Marijn Haverbeke <[email protected]> | 2011-04-08 00:46:41 +0200 |
| commit | 32e62d01510c7b1c0dbd39f9ecc9fd997c2ff2b9 (patch) | |
| tree | 50fafabd2ec99bcfb6b025ff08003199cba49a6c /src/comp/driver | |
| parent | add -O2 when compiling rt, fix warnings triggered by optimizer (diff) | |
| download | rust-32e62d01510c7b1c0dbd39f9ecc9fd997c2ff2b9.tar.xz rust-32e62d01510c7b1c0dbd39f9ecc9fd997c2ff2b9.zip | |
add a -parse-only option to rustc
(undocumented, only used for profiling the parser)
Diffstat (limited to 'src/comp/driver')
| -rw-r--r-- | src/comp/driver/rustc.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 928c934a..28953696 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -59,10 +59,12 @@ impure fn compile_input(session.session sess, str input, str output, bool shared, bool optimize, + bool parse_only, vec[str] library_search_paths) { auto def = tup(0, 0); auto p = parser.new_parser(sess, env, def, input); auto crate = parse_input(sess, p, input); + if (parse_only) {ret;} crate = creader.read_crates(sess, crate, library_search_paths); crate = resolve.resolve_crate(sess, crate); auto typeck_result = typeck.check_crate(sess, crate); @@ -132,6 +134,7 @@ impure fn main(vec[str] args) { let bool shared = false; let bool pretty = false; let bool ls = false; + let bool parse_only = false; let bool glue = false; // FIXME: Maybe we should support -O0, -O1, -Os, etc @@ -156,6 +159,8 @@ impure fn main(vec[str] args) { pretty = true; } else if (_str.eq(arg, "-ls")) { ls = true; + } else if (_str.eq(arg, "-parse-only")) { + parse_only = true; } else if (_str.eq(arg, "-o")) { if (i+1u < len) { output_file = some(args.(i+1u)); @@ -228,11 +233,13 @@ impure fn main(vec[str] args) { parts += vec(".bc"); auto ofile = _str.concat(parts); compile_input(sess, env, ifile, ofile, shared, - optimize, library_search_paths); + optimize, parse_only, + library_search_paths); } case (some[str](?ofile)) { compile_input(sess, env, ifile, ofile, shared, - optimize, library_search_paths); + optimize, parse_only, + library_search_paths); } } } |