diff options
| author | Seo Sanghyeon <sanxiyn@gmail.com> | 2016-11-21 20:30:05 +0900 |
|---|---|---|
| committer | Seo Sanghyeon <sanxiyn@gmail.com> | 2016-11-21 20:30:05 +0900 |
| commit | c45f3dee1010cc15c259f536f736396a5a5f585d (patch) | |
| tree | c105660f6214425321c57c6eeb0d3248a63b74f2 /src/rustllvm/RustWrapper.cpp | |
| parent | fc2373c5a24646745dcbc14dc58889a9d8843f4e (diff) | |
| download | rust-c45f3dee1010cc15c259f536f736396a5a5f585d.tar.gz rust-c45f3dee1010cc15c259f536f736396a5a5f585d.zip | |
Restore compatibility with LLVM 3.7 and 3.8
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 7f0c7e2e5c9..b035e134e37 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -155,13 +155,10 @@ from_rust(LLVMRustAttribute kind) { } } -extern "C" LLVMAttributeRef LLVMRustCreateAttribute(LLVMContextRef C, LLVMRustAttribute Kind, uint64_t Val) { - return wrap(Attribute::get(*unwrap(C), from_rust(Kind), Val)); -} - -extern "C" void LLVMRustAddCallSiteAttribute(LLVMValueRef Instr, unsigned index, LLVMAttributeRef attr) { +extern "C" void LLVMRustAddCallSiteAttribute(LLVMValueRef Instr, unsigned index, LLVMRustAttribute attr) { CallSite Call = CallSite(unwrap<Instruction>(Instr)); - AttrBuilder B(unwrap(attr)); + Attribute Attr = Attribute::get(Call->getContext(), from_rust(attr)); + AttrBuilder B(Attr); Call.setAttributes( Call.getAttributes().addAttributes(Call->getContext(), index, AttributeSet::get(Call->getContext(), @@ -183,10 +180,11 @@ extern "C" void LLVMRustAddDereferenceableCallSiteAttr(LLVMValueRef Instr, extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned index, - LLVMAttributeRef attr) + LLVMRustAttribute attr) { Function *A = unwrap<Function>(Fn); - AttrBuilder B(unwrap(attr)); + Attribute Attr = Attribute::get(A->getContext(), from_rust(attr)); + AttrBuilder B(Attr); A->addAttributes(index, AttributeSet::get(A->getContext(), index, B)); } @@ -212,11 +210,12 @@ extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn, extern "C" void LLVMRustRemoveFunctionAttributes(LLVMValueRef Fn, unsigned index, - LLVMAttributeRef attr) + LLVMRustAttribute attr) { Function *F = unwrap<Function>(Fn); const AttributeSet PAL = F->getAttributes(); - AttrBuilder B(unwrap(attr)); + Attribute Attr = Attribute::get(F->getContext(), from_rust(attr)); + AttrBuilder B(Attr); const AttributeSet PALnew = PAL.removeAttributes(F->getContext(), index, AttributeSet::get(F->getContext(), index, B)); |
