diff options
| author | bors <bors@rust-lang.org> | 2016-11-21 11:23:04 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-21 11:23:04 -0600 |
| commit | 80a95e34fe32ca86982607a85e9c5714eb6262d9 (patch) | |
| tree | 1630905fd6d656f1723db4f6c27c35d6deab8f8c /src/rustllvm/RustWrapper.cpp | |
| parent | ebec55406ba94faf8b2cd23b27a8f74df97d1ca4 (diff) | |
| parent | c45f3dee1010cc15c259f536f736396a5a5f585d (diff) | |
| download | rust-80a95e34fe32ca86982607a85e9c5714eb6262d9.tar.gz rust-80a95e34fe32ca86982607a85e9c5714eb6262d9.zip | |
Auto merge of #37912 - sanxiyn:llvm-compat, r=eddyb
Restore compatibility with LLVM 3.7 and 3.8 This should fix Travis build.
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)); |
