aboutsummaryrefslogtreecommitdiff
path: root/src/zig_llvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zig_llvm.cpp')
-rw-r--r--src/zig_llvm.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/zig_llvm.cpp b/src/zig_llvm.cpp
index b4bdf7c033..55e507c6d0 100644
--- a/src/zig_llvm.cpp
+++ b/src/zig_llvm.cpp
@@ -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);
}