about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-04-19 10:56:25 -0700
committerbors <bors@rust-lang.org>2014-04-19 10:56:25 -0700
commit3db2b6933d33d9a27bfd82e6de083d4aebe75a3b (patch)
tree85677a3099045450ce4ff4ffe35f0ceef068813d /src/rustllvm/RustWrapper.cpp
parentba25fecfeffdbc96d31172f483bd20cffa635b3e (diff)
parent50fb57bb107b302f7d164e22aa75c8c2a2d48756 (diff)
downloadrust-3db2b6933d33d9a27bfd82e6de083d4aebe75a3b.tar.gz
rust-3db2b6933d33d9a27bfd82e6de083d4aebe75a3b.zip
auto merge of #13628 : alexcrichton/rust/issue-13625, r=thestinger
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.cpp12
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);