From aed40fbcd8e81cc1ef7a51b40b76b4631cba299e Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Wed, 9 Mar 2011 11:41:50 +0100 Subject: Have the pretty-printer take a writer stream as argument It now uses a string writer to also fill in for middle.ty.ast_ty_to_str --- src/comp/driver/rustc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/comp/driver') diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 7ad0cdc7..6366bcaf 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -66,7 +66,7 @@ impure fn pretty_print_input(session.session sess, str input) { auto p = front.parser.new_parser(sess, env, 0, input); auto crate = front.parser.parse_crate_from_source_file(p); - pretty.pprust.print_ast(crate.node.module); + pretty.pprust.print_ast(crate.node.module, std.io.stdout_writer()); } fn warn_wrong_compiler() { -- cgit v1.2.3 From 4ca0259b20bfc2f33f23e8b82864908fbb3b8133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Thu, 10 Mar 2011 17:34:58 -0500 Subject: Update the current id when we create sub parsers. --- src/comp/driver/rustc.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/comp/driver') diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index 6366bcaf..f26dd02e 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -54,7 +54,8 @@ impure fn compile_input(session.session sess, eval.env env, str input, str output, bool shared) { - auto p = parser.new_parser(sess, env, 0, input); + auto def = tup(0, 0); + auto p = parser.new_parser(sess, env, def, input); auto crate = parse_input(sess, p, input); crate = resolve.resolve_crate(sess, crate); crate = typeck.check_crate(sess, crate); @@ -64,7 +65,8 @@ impure fn compile_input(session.session sess, impure fn pretty_print_input(session.session sess, eval.env env, str input) { - auto p = front.parser.new_parser(sess, env, 0, input); + auto def = tup(0, 0); + auto p = front.parser.new_parser(sess, env, def, input); auto crate = front.parser.parse_crate_from_source_file(p); pretty.pprust.print_ast(crate.node.module, std.io.stdout_writer()); } -- cgit v1.2.3 From 3aac5059ee986126851cb4f8bd312f1fb5f9ddea Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 10 Mar 2011 17:25:11 -0800 Subject: Move the glue code to a .o file. This reduces how much asm we print in each "translation unit". Part of it is not repetitive and should probably be moved to a .ll file, but for now we autogen all of it. (Modified somewhat by graydon while integrating). --- src/comp/driver/rustc.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/comp/driver') diff --git a/src/comp/driver/rustc.rs b/src/comp/driver/rustc.rs index f26dd02e..00d41fff 100644 --- a/src/comp/driver/rustc.rs +++ b/src/comp/driver/rustc.rs @@ -84,6 +84,7 @@ fn usage(session.session sess, str argv0) { log ""; log " -o write output to "; log " -nowarn suppress wrong-compiler warning"; + log " -glue generate glue.bc file"; log " -shared compile a shared-library crate"; log " -pp pretty-print the input instead of compiling"; log " -h display this message"; @@ -113,6 +114,7 @@ impure fn main(vec[str] args) { let bool do_warn = true; let bool shared = false; let bool pretty = false; + let bool glue = false; auto i = 1u; auto len = _vec.len[str](args); @@ -123,6 +125,8 @@ impure fn main(vec[str] args) { if (_str.byte_len(arg) > 0u && arg.(0) == '-' as u8) { if (_str.eq(arg, "-nowarn")) { do_warn = false; + } else if (_str.eq(arg, "-glue")) { + glue = true; } else if (_str.eq(arg, "-shared")) { shared = true; } else if (_str.eq(arg, "-pp")) { @@ -159,6 +163,18 @@ impure fn main(vec[str] args) { warn_wrong_compiler(); } + if (glue) { + alt (output_file) { + case (none[str]) { + middle.trans.make_common_glue("glue.bc"); + } + case (some[str](?s)) { + middle.trans.make_common_glue(s); + } + } + ret; + } + alt (input_file) { case (none[str]) { usage(sess, args.(0)); -- cgit v1.2.3