Bug fix for rethrow + defer catch. More types and functions for win32

This commit is contained in:
Christoffer Lerno
2024-07-02 02:48:48 +02:00
parent 326fc501e2
commit ce17dbe240
4 changed files with 113 additions and 0 deletions

View File

@@ -4367,7 +4367,9 @@ static inline void llvm_emit_rethrow_expr(GenContext *c, BEValue *be_value, Expr
// Ensure we are on a branch that is non-empty.
if (llvm_emit_check_block_branch(c))
{
c->defer_error_var = error_var;
llvm_emit_statement_chain(c, expr->rethrow_expr.cleanup);
c->defer_error_var = NULL;
BEValue value;
llvm_value_set_address_abi_aligned(&value, error_var, type_anyfault);
if (expr->rethrow_expr.in_block)
@@ -6804,6 +6806,7 @@ static LLVMValueRef llvm_get_benchmark_hook_global(GenContext *c, Expr *expr)
INLINE void llvm_emit_last_fault(GenContext *c, BEValue *value)
{
assert(c->defer_error_var);
llvm_value_set_address_abi_aligned(value, c->defer_error_var, type_anyfault);
}