mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
Adding trap on debug builds.
This commit is contained in:
@@ -600,6 +600,18 @@ void gencontext_emit_scoped_stmt(GenContext *context, Ast *ast)
|
||||
gencontext_emit_defer(context, ast->scoped_stmt.defers.start, ast->scoped_stmt.defers.end);
|
||||
}
|
||||
|
||||
void gencontext_emit_panic_on_true(GenContext *context, LLVMValueRef value, const char *panic_name)
|
||||
{
|
||||
LLVMBasicBlockRef panic_block = gencontext_create_free_block(context, "panic");
|
||||
LLVMBasicBlockRef ok_block = gencontext_create_free_block(context, "checkok");
|
||||
gencontext_emit_cond_br(context, value, panic_block, ok_block);
|
||||
gencontext_emit_block(context, panic_block);
|
||||
gencontext_emit_call_intrinsic(context, trap_intrinsic_id, NULL, NULL, 0);
|
||||
gencontext_emit_br(context, ok_block);
|
||||
gencontext_emit_block(context, ok_block);
|
||||
}
|
||||
|
||||
|
||||
void gencontext_emit_stmt(GenContext *context, Ast *ast)
|
||||
{
|
||||
switch (ast->ast_kind)
|
||||
|
||||
Reference in New Issue
Block a user