stage1: Fix emission of sret annotation for LLVM

LLVM12 deprecated `sret` and replaced it with the `sret(<Ty>)` form.

Closes #8075
This commit is contained in:
LemonBoy
2021-02-26 15:24:08 +01:00
committed by Andrew Kelley
parent 431801707f
commit b706b9bce7
3 changed files with 14 additions and 3 deletions

View File

@@ -798,7 +798,17 @@ void ZigLLVMAddByValAttr(LLVMValueRef fn_ref, unsigned ArgNo, LLVMTypeRef type_v
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);
const AttributeList new_attr_set = attr_set.addAttributes(func->getContext(), ArgNo + 1, attr_builder);
func->setAttributes(new_attr_set);
}
void ZigLLVMAddSretAttr(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.addStructRetAttr(llvm_type);
const AttributeList new_attr_set = attr_set.addAttributes(func->getContext(), ArgNo + 1, attr_builder);
func->setAttributes(new_attr_set);
}