diff options
| author | gingerBill <bill@gingerbill.org> | 2021-04-22 10:35:17 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-04-22 10:35:17 +0100 |
| commit | 47c7dc6a9bfc679f027984bd68523743b4d7734f (patch) | |
| tree | 8ba1ec35c1e2c0b0229a78ccee3dfc91381b69f5 /src/check_stmt.cpp | |
| parent | 65551ba8fb862a9caef97b3c84b17baa7715bbb6 (diff) | |
Add new intrinsics: debug_trap, trap, read_cycle_counter, expect
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 0ce0ff6a0..7d9eefe19 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -10,7 +10,19 @@ bool is_diverging_stmt(Ast *stmt) { String name = expr->CallExpr.proc->BasicDirective.name; return name == "panic"; } - Type *t = type_of_expr(expr->CallExpr.proc); + Ast *proc = unparen_expr(expr->CallExpr.proc); + TypeAndValue tv = proc->tav; + if (tv.mode == Addressing_Builtin) { + Entity *e = entity_of_node(proc); + BuiltinProcId id = BuiltinProc_Invalid; + if (e != nullptr) { + id = cast(BuiltinProcId)e->Builtin.id; + } else { + id = BuiltinProc_DIRECTIVE; + } + return builtin_procs[id].diverging; + } + Type *t = tv.type; t = base_type(t); return t != nullptr && t->kind == Type_Proc && t->Proc.diverging; } |