From 50fb57bb107b302f7d164e22aa75c8c2a2d48756 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 19 Apr 2014 10:33:46 -0700 Subject: 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 --- src/rustllvm/RustWrapper.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/rustllvm/RustWrapper.cpp') 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(fn)->addFnAttr(Name); } +extern "C" void LLVMRemoveFunctionAttrString(LLVMValueRef fn, const char *Name) { + Function *f = unwrap(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(Fn); -- cgit 1.4.1-3-g733a5