Created
May 11, 2021 18:46
-
-
Save andrewrk/14df655282b08e240d2637027c28d350 to your computer and use it in GitHub Desktop.
reset error return trace index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (instruction->operand != nullptr && | |
instruction->operand->value->type->id != ZigTypeIdErrorSet && | |
instruction->operand->value->type->id != ZigTypeIdErrorUnion) | |
{ | |
// Reset error return trace index. | |
bool is_llvm_alloca = false; | |
LLVMValueRef err_ret_trace_ptr = get_cur_err_ret_trace_val(g, instruction->base.base.scope, &is_llvm_alloca); | |
if (err_ret_trace_ptr != nullptr) { | |
size_t index_field_index = g->stack_trace_type->data.structure.fields[0]->gen_index; | |
LLVMValueRef index_field_ptr = LLVMBuildStructGEP(g->builder, err_ret_trace_ptr, (unsigned)index_field_index, ""); | |
LLVMValueRef zero = LLVMConstNull(g->builtin_types.entry_usize->llvm_type); | |
gen_store_untyped(g, zero, index_field_ptr, 0, false); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment