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
This commit is contained in:
Alex Crichton 2014-04-19 10:33:46 -07:00
parent ba25fecfef
commit 50fb57bb10
3 changed files with 22 additions and 2 deletions

View file

@ -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);