Pass type to byval attributes
This commit is contained in:
parent
04304fcd16
commit
eb33822091
4 changed files with 60 additions and 30 deletions
|
@ -237,6 +237,17 @@ extern "C" void LLVMRustAddDereferenceableOrNullCallSiteAttr(LLVMValueRef Instr,
|
|||
Call->getContext(), Index, B));
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustAddByValCallSiteAttr(LLVMValueRef Instr, unsigned Index,
|
||||
LLVMTypeRef Ty) {
|
||||
CallSite Call = CallSite(unwrap<Instruction>(Instr));
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
Attribute Attr = Attribute::getWithByValType(Call->getContext(), unwrap(Ty));
|
||||
#else
|
||||
Attribute Attr = Attribute::get(Call->getContext(), Attribute::ByVal);
|
||||
#endif
|
||||
Call.addAttribute(Index, Attr);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustAddFunctionAttribute(LLVMValueRef Fn, unsigned Index,
|
||||
LLVMRustAttribute RustAttr) {
|
||||
Function *A = unwrap<Function>(Fn);
|
||||
|
@ -271,6 +282,17 @@ extern "C" void LLVMRustAddDereferenceableOrNullAttr(LLVMValueRef Fn,
|
|||
A->addAttributes(Index, B);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustAddByValAttr(LLVMValueRef Fn, unsigned Index,
|
||||
LLVMTypeRef Ty) {
|
||||
Function *F = unwrap<Function>(Fn);
|
||||
#if LLVM_VERSION_GE(9, 0)
|
||||
Attribute Attr = Attribute::getWithByValType(F->getContext(), unwrap(Ty));
|
||||
#else
|
||||
Attribute Attr = Attribute::get(F->getContext(), Attribute::ByVal);
|
||||
#endif
|
||||
F->addAttribute(Index, Attr);
|
||||
}
|
||||
|
||||
extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn,
|
||||
unsigned Index,
|
||||
const char *Name,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue