aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-03-09 22:06:24 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-03-10 01:38:40 -0500
commit60b2031831320186f3920d63cfa35bda40930450 (patch)
tree1c09db35eab1d6bac66db99f02a891811da230c3 /src/codegen.cpp
parent20011a7a1c1f08644cd82a3c3e1d57cba9980695 (diff)
downloadzig-60b2031831320186f3920d63cfa35bda40930450.tar.gz
zig-60b2031831320186f3920d63cfa35bda40930450.zip
improvements to stack traces
* @panic generates an error return trace * printing an error return trace no longer interferes with normal stack traces. * instead of ignore_frame_count, we look at the return address when you call panic, and that's the first stack trace function makes stack traces much cleaner - the error return trace flows gracefully into the stack trace
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 4a7b8f628f..f4275243c3 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3299,8 +3299,8 @@ static LLVMValueRef ir_render_align_cast(CodeGen *g, IrExecutable *executable, I
static LLVMValueRef ir_render_error_return_trace(CodeGen *g, IrExecutable *executable,
IrInstructionErrorReturnTrace *instruction)
{
- TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
if (g->cur_err_ret_trace_val == nullptr) {
+ TypeTableEntry *ptr_to_stack_trace_type = get_ptr_to_stack_trace_type(g);
return LLVMConstNull(ptr_to_stack_trace_type->type_ref);
}
return g->cur_err_ret_trace_val;
@@ -3925,7 +3925,7 @@ static LLVMValueRef ir_render_container_init_list(CodeGen *g, IrExecutable *exec
}
static LLVMValueRef ir_render_panic(CodeGen *g, IrExecutable *executable, IrInstructionPanic *instruction) {
- gen_panic(g, ir_llvm_value(g, instruction->msg), nullptr);
+ gen_panic(g, ir_llvm_value(g, instruction->msg), g->cur_err_ret_trace_val);
return nullptr;
}