From 663a1d0cd56c933f6ce85c16924e161b5cb55a8a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 4 Feb 2016 17:43:57 -0700 Subject: [PATCH] switch trap in debug mode when no prong found --- src/codegen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/codegen.cpp b/src/codegen.cpp index 3d45413ec7..f4defb8405 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -2412,6 +2412,9 @@ static LLVMValueRef gen_switch_expr(CodeGen *g, AstNode *node) { if (!else_prong) { LLVMPositionBuilderAtEnd(g->builder, else_block); add_debug_source_node(g, node); + if (!g->is_release_build) { + LLVMBuildCall(g->builder, g->trap_fn_val, nullptr, 0, ""); + } LLVMBuildUnreachable(g->builder); }