aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-02-04 17:43:57 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-02-04 17:43:57 -0700
commit663a1d0cd56c933f6ce85c16924e161b5cb55a8a (patch)
tree6151949db43a73a13e0b7d3d10cc3367b2b87349 /src
parent093e0d1bb020e6b7245d142b1fc75bdbd7868045 (diff)
downloadzig-663a1d0cd56c933f6ce85c16924e161b5cb55a8a.tar.gz
zig-663a1d0cd56c933f6ce85c16924e161b5cb55a8a.zip
switch trap in debug mode when no prong found
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp3
1 files changed, 3 insertions, 0 deletions
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);
}