diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-19 10:33:46 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-04-19 10:33:46 -0700 |
| commit | 50fb57bb107b302f7d164e22aa75c8c2a2d48756 (patch) | |
| tree | 85677a3099045450ce4ff4ffe35f0ceef068813d /src/rustllvm/RustWrapper.cpp | |
| parent | ba25fecfeffdbc96d31172f483bd20cffa635b3e (diff) | |
| download | rust-50fb57bb107b302f7d164e22aa75c8c2a2d48756.tar.gz rust-50fb57bb107b302f7d164e22aa75c8c2a2d48756.zip | |
rustc: Ensure closures are "split-stack"
In upgrading LLVM, only rust functions had the "split-stack" attribute added. This commit changes the addition of LLVM's "split-stack" attribute to *always* occur and then we remove it sometimes if the "no_split_stack" rust attribute is present. Closes #13625
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 035a39669de..3fe1b1380da 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -77,6 +77,18 @@ extern "C" void LLVMAddFunctionAttrString(LLVMValueRef fn, const char *Name) { unwrap<Function>(fn)->addFnAttr(Name); } +extern "C" void LLVMRemoveFunctionAttrString(LLVMValueRef fn, const char *Name) { + Function *f = unwrap<Function>(fn); + LLVMContext &C = f->getContext(); + AttrBuilder B; + B.addAttribute(Name); + AttributeSet to_remove = AttributeSet::get(C, AttributeSet::FunctionIndex, B); + + AttributeSet attrs = f->getAttributes(); + f->setAttributes(attrs.removeAttributes(f->getContext(), + AttributeSet::FunctionIndex, + to_remove)); +} extern "C" void LLVMAddReturnAttribute(LLVMValueRef Fn, LLVMAttribute PA) { Function *A = unwrap<Function>(Fn); |
