always give the type to byval attribute

This commit is contained in:
Andrew Kelley
2019-07-20 13:32:50 -04:00
parent 05454123d4
commit 2c1e955de7
3 changed files with 12 additions and 1 deletions

View File

@@ -723,6 +723,16 @@ void ZigLLVMSetFastMath(LLVMBuilderRef builder_wrapped, bool on_state) {
}
}
void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_val) {
Function *func = unwrap<Function>(fn_ref);
const AttributeList attr_set = func->getAttributes();
AttrBuilder attr_builder;
Type *llvm_type = unwrap<Type>(type_val);
attr_builder.addByValAttr(llvm_type);
const AttributeList new_attr_set = attr_set.addAttributes(func->getContext(), ArgNo, attr_builder);
func->setAttributes(new_attr_set);
}
void ZigLLVMAddFunctionAttr(LLVMValueRef fn_ref, const char *attr_name, const char *attr_value) {
Function *func = unwrap<Function>(fn_ref);
const AttributeList attr_set = func->getAttributes();