about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBjörn Steinbrink <bsteinbr@gmail.com>2014-02-23 12:25:11 +0100
committerAlex Crichton <alex@alexcrichton.com>2014-02-24 21:22:26 -0800
commit0309104cc59d6290fba2fe6dd9bfdc18aacab5f8 (patch)
treeb2b69f5c95c886bc044d7c3e31331be162216127
parent8812e8ad4957e3e201dabb62c6c3a8e0b10333a7 (diff)
downloadrust-0309104cc59d6290fba2fe6dd9bfdc18aacab5f8.tar.gz
rust-0309104cc59d6290fba2fe6dd9bfdc18aacab5f8.zip
Mark by-value parameters that are passed on the stack as nocapture
The by-value argument is a copy that is only valid for the duration of
the function call, therefore keeping any pointer to it that outlives the
call is illegal.
-rw-r--r--src/librustc/middle/trans/base.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 5b3c18a5a93..5df6c231b5c 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -282,6 +282,7 @@ pub fn decl_rust_fn(ccx: &CrateContext, has_env: bool,
                 if !type_is_immediate(ccx, arg_ty) {
                     unsafe {
                         llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
+                        llvm::LLVMAddAttribute(llarg, lib::llvm::NoCaptureAttribute as c_uint);
                     }
                 }
             }