Files
c3c/test/test_suite/errors/rethrow.c3t
Christoffer Lerno 25bccf4883 New faults and syntax (#2034)
- Remove `[?]` syntax.
- Change `int!` to `int?` syntax.
- New `fault` declarations.
- Enum associated values can reference the calling enum.
2025-03-10 00:11:35 +01:00

35 lines
876 B
Plaintext

// #target: macos-x64
fn void? test()
{
int? i;
i!;
}
/* #expect: rethrow.ll
%i = alloca i32, align 4
%i.f = alloca i64, align 8
%error_var = alloca i64, align 8
store i64 0, ptr %i.f, align 8
store i32 0, ptr %i, align 4
%optval = load i64, ptr %i.f, align 8
%not_err = icmp eq i64 %optval, 0
%0 = call i1 @llvm.expect.i1(i1 %not_err, i1 true)
br i1 %0, label %after_check, label %assign_optional
assign_optional: ; preds = %entry
store i64 %optval, ptr %error_var, align 8
br label %guard_block
after_check: ; preds = %entry
br label %noerr_block
guard_block: ; preds = %assign_optional
%1 = load i64, ptr %error_var, align 8
ret i64 %1
noerr_block: ; preds = %after_check
ret i64 0
}