| ... | @@ -2876,6 +2876,7 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -2876,6 +2876,7 @@ static void do_code_gen(CodeGen *g) { |
| 2876 | if (handle_is_ptr(fn_type->data.fn.fn_type_id.return_type)) { | 2876 | if (handle_is_ptr(fn_type->data.fn.fn_type_id.return_type)) { |
| 2877 | LLVMValueRef first_arg = LLVMGetParam(fn_table_entry->fn_value, 0); | 2877 | LLVMValueRef first_arg = LLVMGetParam(fn_table_entry->fn_value, 0); |
| 2878 | LLVMAddAttribute(first_arg, LLVMStructRetAttribute); | 2878 | LLVMAddAttribute(first_arg, LLVMStructRetAttribute); |
| | 2879 | LLVMZigAddNonNullAttr(fn_table_entry->fn_value, 1); |
| 2879 | } | 2880 | } |
| 2880 | | 2881 | |
| 2881 | // set parameter attributes | 2882 | // set parameter attributes |
| ... | @@ -2903,12 +2904,7 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -2903,12 +2904,7 @@ static void do_code_gen(CodeGen *g) { |
| 2903 | LLVMAddAttribute(argument_val, LLVMReadOnlyAttribute); | 2904 | LLVMAddAttribute(argument_val, LLVMReadOnlyAttribute); |
| 2904 | } | 2905 | } |
| 2905 | if (param_type->id == TypeTableEntryIdPointer) { | 2906 | if (param_type->id == TypeTableEntryIdPointer) { |
| 2906 | // when https://github.com/andrewrk/zig/issues/82 is fixed, add | 2907 | LLVMZigAddNonNullAttr(fn_table_entry->fn_value, gen_index + 1); |
| 2907 | // non null attribute here | | |
| 2908 | | | |
| 2909 | ///`i` is arg index + 1 | | |
| 2910 | ///I think that 0 is the return index, but it has a named LLVM constant variable | | |
| 2911 | LLVMZigAddNonNullAttr(fn_table_entry->fn_value, param_decl_i + 1); | | |
| 2912 | } | 2908 | } |
| 2913 | if (is_byval) { | 2909 | if (is_byval) { |
| 2914 | // TODO | 2910 | // TODO |