diff options
| author | Elliott Slaughter <eslaughter@mozilla.com> | 2012-06-26 14:27:09 -0700 |
|---|---|---|
| committer | Elliott Slaughter <eslaughter@mozilla.com> | 2012-08-24 14:01:27 -0700 |
| commit | 7706262a730ac7bbea73decc551cdafffa8f1dbd (patch) | |
| tree | 13843fbc5db4349297b157a4986dfc667c1e32c3 /src | |
| parent | 30768d3609d905439a129e7e9bf4571b38e321f3 (diff) | |
| download | rust-7706262a730ac7bbea73decc551cdafffa8f1dbd.tar.gz rust-7706262a730ac7bbea73decc551cdafffa8f1dbd.zip | |
rustc: Add flag for enabling GC.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rustc/driver/driver.rs | 2 | ||||
| -rw-r--r-- | src/rustc/driver/session.rs | 2 | ||||
| -rw-r--r-- | src/rustc/middle/trans/base.rs | 7 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index 97358154e99..087c6c3b833 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -421,6 +421,7 @@ fn build_session_options(matches: getopts::matches, session::unknown_crate }; let static = opt_present(matches, ~"static"); + let gc = opt_present(matches, ~"gc"); let parse_only = opt_present(matches, ~"parse-only"); let no_trans = opt_present(matches, ~"no-trans"); @@ -519,6 +520,7 @@ fn build_session_options(matches: getopts::matches, let sopts: @session::options = @{crate_type: crate_type, static: static, + gc: gc, optimize: opt_level, debuginfo: debuginfo, extra_debuginfo: extra_debuginfo, diff --git a/src/rustc/driver/session.rs b/src/rustc/driver/session.rs index 039a5b4d14a..cd663c06ce7 100644 --- a/src/rustc/driver/session.rs +++ b/src/rustc/driver/session.rs @@ -82,6 +82,7 @@ type options = // with additional crate configurations during the compile process {crate_type: crate_type, static: bool, + gc: bool, optimize: OptLevel, debuginfo: bool, extra_debuginfo: bool, @@ -221,6 +222,7 @@ fn basic_options() -> @options { @{ crate_type: session::lib_crate, static: false, + gc: false, optimize: No, debuginfo: false, extra_debuginfo: false, diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 74eab331f46..1f1e204d54e 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -4792,6 +4792,13 @@ fn trans_closure(ccx: @crate_ctxt, path: path, decl: ast::fn_decl, some(body.span)); create_llargs_for_fn_args(fcx, ty_self, decl.inputs); + // Set GC for function. + if ccx.sess.opts.gc { + do str::as_c_str("generic") |strategy| { + llvm::LLVMSetGC(fcx.llfn, strategy); + } + } + // Create the first basic block in the function and keep a handle on it to // pass to finish_fn later. let bcx_top = top_scope_block(fcx, body.info()); |
